1 Answer
1

If you use add_filter('the_content'), your function will be called everytime the content of a post is output, whether a single post or a series of posts in a loop. If you need to "hook" before any post content is output in a page, the only dynamic parts of all WP themes you can reach are get_header() or get_sidebar() (or event get_footer). So your best luck would be not to use a filter with the content, but an action, with get_header, like this :