Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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 at 22:17
    
@shunya Yes, see my update. –  toscho Feb 6 at 22:19
    
perfect! thanks! –  shunya Feb 6 at 22:21

Your Answer

 
discard

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.