The WPFolks app is out on iPhone. Free, no ads. Download on the App Store
Skip to main content
Login Join
Snippet · PHP

Automatically Add a Disclaimer to WordPress Posts

Shared by Amit Dholiya · October 1, 2026 · @the_content

6 views
1 upvote
Back to Snippets

Steps

  1. Add the PHP code to your theme’s functions.php.
  2. Save the changes.
  3. Open any single blog post.
  4. The disclaimer will automatically appear after the post content.
/**
 * Add a custom disclaimer to WordPress posts
 */
function custom_post_disclaimer( $content ) {

    if ( ! is_single() || ! is_main_query() || ! in_the_loop() ) {
        return $content;
    }

    $disclaimer  = '<div class="post-disclaimer">';
    $disclaimer .= '<strong>Disclaimer:</strong> ';
    $disclaimer .= 'The information provided in this article is for general informational purposes only.';
    $disclaimer .= '</div>';

    return $content . $disclaimer;
}

add_filter( 'the_content', 'custom_post_disclaimer' );

Tested on

WordPress 6.8

Reported by the author on October 1, 2026. WPFolks has not verified this.

Not tested against WordPress 7.1.3. It may still work.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments