Replace wordpress Content in PRE Tags with HTML Entities

May 26, 2010

If you have a website that often display some code on your wordpress, you know the important of converting PRE tag content to their HTML entities. Doing so prevents worlds of possible rendering issues. Just paste the following in your functions.php file. Once saved, it will automatically replace all content within <pre> and </pre> tags by html entities. //replaces pre content with html entities function pre_entities($matches) { return str_replace($matches[1],htmlentities($matches[1]),$matches[0]); } //to... [Read the full story]