Disclaimer: sorry if this has been asked/answered, but I couldn't find the right search phrase to get something similar.

I'm editing a template for a site I did not build, and I stumbled across funky behaviour. It's probably intentional and not a bug, but can someone explain why this happens?

This site uses a plugin called Teams that allows the client to input their staff members. It appears to use single.php to output the team members (which in turn seems to load content-single.php via get_template_part( 'content', 'single' );.

In the footer of the site, a disclaimer was hardcoded like this:

$disclaimer_post_id = 311;
$disclaimer_query = get_post($disclaimer_post_id);
$disclaimer = apply_filters('the_content', $disclaimer_query->post_content);
echo $disclaimer;

So! On each "regular" page on the site, this works just fine. However, when viewing a single team member, it actually re-outputs their fields (name/title, writeup/description, even social media links and edit button like a normal WP post) so instead of a disclaimer we get duplicated content in the footer from above.

I went through and did a print_r() on $disclaimer_query and I can see that $disclaimer_query->post_content is actually the disclaimer text!

Here's my question:

Why does apply_filters() alter the output? Does it have something to do with the fact that no custom query seems to be used before get_post() is called?

1 Answer 1


the_content filter takes only one parameter - $content, so you can't check what post this $content comes from.

So if the plugin Team performs incorrect checks (it can for example use is_singular( <POST_TYPE> )), then it will modify all contents printed on single team member page.

You'll have to check what functions are assigned to the_content hook and check what exactly are they doing...

  • I'm still confused - we're supplying the content from our custom query of get_post and I know from debugging that content that it's correct (it's the disclaimer). So what do you mean I can't check what post it comes from? It's only when apply_filters is called that it gets changed. Jun 3, 2018 at 17:47
  • 1
    apply_filters calls functions that are assigned to this hook. You have to check what functions are assigned to it and how do they work. Here's the answer showing how to find them: wordpress.stackexchange.com/questions/105039/… Jun 3, 2018 at 17:54
  • 1
    Ohhhh. I think I see what you're saying. I'll check out that other question. Thanks! Jun 3, 2018 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.