1

Is there a filter or hook that is triggered just before post content is rendered?

What I'd like to do is to apply a filter to the text content of a post just before the post text is being rendered.

1 Answer 1

4

Can you not simply use the_content filter hook?

function mytheme_content_filter( $content ) {
     // Do stuff to $content, which contains the_content()
     // Then return it
     return $content;
}
add_filter( 'the_content', 'mytheme_content_filter' );
3
  • 2
    That's simply the filter I was looking for.
    – Luke
    Commented Jul 8, 2011 at 21:04
  • Resurrecting this old thread to notice that, by using the filter, all tags get stripped. How can I keep my tags?
    – Ciprian
    Commented Nov 13, 2012 at 9:17
  • @CiprianPopescu I would recommend starting a new question. It sounds to me like your issue isn't necessarily related to this question or answer. Adding your own question would allow you to elaborate more on the exact nature of your issue. Commented Nov 13, 2012 at 14:20

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.