WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to make a post where there is a text line :

some libraries to run which we will import by using "#include <filename.h>" command.

instead of outputting the text as it is. It shows as:

some libraries to run which we will import by using “#include ” command.

in post so <filename.h> is missing for some reason. I am quite sure I am missing something here but unable to find. I think for some reason WordPress escapes anything between <> tags so how can i show them if i need to?

share|improve this question
up vote 1 down vote accepted

You have to escape th < and the > with &lt; and &gt;, otherwise WordPress will remove the “unknown tags”.

You could also filter pre_kses to change the output before it gets stripped.

add_filter( 'pre_kses', function( $str ) {
    // find and escape < and > on specific positions, then
    return $str;
share|improve this answer
is there anything that I can add before < and > chars to escape them like in most programming languages like java or c we add "\" to escape them? – shunya Feb 6 '14 at 22:17
@shunya Yes, see my update. – toscho Feb 6 '14 at 22:19
perfect! thanks! – shunya Feb 6 '14 at 22:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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