WordPress syntaxhighlighter plugin not displaying && properly

Due to problems in WordPress (Gutenberg), syntaxhighlighter plugin will now show && when code is posted. Without the following filter added to your template, this happens.

To remove this horrible error, add the following code to your template theme functions.php;

add_filter('syntaxhighlighter_htmlresult', function($html) {
	return preg_replace('/&([^;]+;)/', '&$1', $html);

Leave a Reply