Fix wordpress SyntaxHighlighter ampersand to “&” issue

The workaround is to add below code into syntaxhighlighter.php

/**
 * Filter to fix issue with & in SyntaxHighlighter Evolved plugin.
 *
 * @param string $code Code to format.
 * @param array $atts Attributes.
 * @param string $tag Tag.
 *
 * @return string
 */
function kagg_syntaxhighlighter_precode( $code, $atts, $tag ) {
    if ( 'code' === $tag ) {
        $code = wp_specialchars_decode( $code );
    }
    return $code;
}
add_filter( 'syntaxhighlighter_precode', 'kagg_syntaxhighlighter_precode', 10, 3 );

1.Go to your wp-admin page

2.On left pane click “Plugins” then “Plugin Editor”

3.select plugin edit to “SyntaxHighlighter Evolved” then click “Select”

4.Add above code to the end of syntaxhighlighter.php

Leave a Reply

Your email address will not be published. Required fields are marked *