"the_content" filter can get added with other filters from plugins and themes which could alter content, when you simply want this to format the post_content to HTML format.

Is there a better solution for this that other plugins do not add filters to and can format the post content to HTML format just like this filter do?

  • 1
    I am not sure what you are trying to do. If another plugin is changing that filter in a way you don't like, uninstall it. That filter is the best way to filter the content for output. Especially if you developing a public plugin. Don't try to reinvent the wheel in a way that cause it to not work as expected.
    – Jake
    Feb 14, 2014 at 0:57
  • 1
    Please clarify what you are asking. Do you want to remove filters from the content, or do you wish to use similar (but not all) filters on other content (such as post meta, or theme options)? Feb 14, 2014 at 7:40

1 Answer 1


The Core filters on the_content are:

131 add_filter( 'the_content', 'wptexturize'        );
132 add_filter( 'the_content', 'convert_smilies'    );
133 add_filter( 'the_content', 'convert_chars'      );
134 add_filter( 'the_content', 'wpautop'            );
135 add_filter( 'the_content', 'shortcode_unautop'  );
136 add_filter( 'the_content', 'prepend_attachment' );

You can apply whichever of those you'd like to any string you'd like. The second parameter is the name of a function which takes a string as input, so...

$str = 'this is my content';
$str = wptexturize($str);
$str = convert_smilies($str);
$str = wpautop($str);

And so on. Use the ones you want. Ignore the others. That should give you plenty of control. Plugins cannot hook in if there is no hook, but be careful robbing a theme of expected functionality is unfriendly and could break things.


  • That makes sense, what I was doing is: $str = 'the text content'; $str = apply_filters('the_content',$str);
    – ashanjay
    Sep 27, 2015 at 17:46
  • convert_smiles should be convert_smilies
    – Christine Cooper
    Dec 21, 2016 at 19:41

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.