replace html entities in posts between pre tags

This one should work add_filter( ‘the_content’, ‘pre_content_filter’, 0 ); function pre_content_filter( $content ) { return preg_replace_callback( ‘|<pre.*>(.*)</pre|isU’ , ‘convert_pre_entities’, $content ); } function convert_pre_entities( $matches ) { return str_replace( $matches[1], html_entity_decode( $matches[1] ), $matches[0] ); } Let me know

Including Angle Brackets In Pre Sections

If you’re just trying to display them in a page or a post, you could try using their character entities. In the Text view in the editor, type &lt; instead of < and &gt; instead of >. So, for instance, in your editor’s Text view (not the Visual mode), you’d type: <pre> private HashMap&lt;String, HashMap&lt;String, … Read more