How can I enable [code] syntax highlighted blocks in the comment section of my WordPress?

I have tried various syntax highlighting plugins. The one I liked the most was SyntaxHighlighter Evolved. My only issue with it was that it did not filter the comment sections.

Here is how to fix that:

1. Go to your Dashboard/Plugins
2. Find the SyntaxHighlighter Evolved plugin and click Edit.
3. In the editor scroll down until you find the section with the comment “Register hooks”
4. Insert the highlighted line as shown below
5. Click “Update file”

		// Register hooks
		add_action( 'admin_menu',                   array(&$this, 'register_settings_page') );
		add_action( 'admin_post_syntaxhighlighter', array(&$this, 'save_settings') );
		add_action( 'admin_head',                   array(&$this, 'admin_head') );
		add_action( 'wp_head',                      array(&$this, 'frontend_styling') );
		add_action( 'wp_footer',                    array(&$this, 'maybe_output_scripts'),      15 );
		add_filter( 'comment_text',                 array(&$this, 'parse_shortcodes'),          9 );
		add_filter( 'the_content',                  array(&$this, 'parse_shortcodes'),          9 );
		add_filter( 'widget_text',                  array(&$this, 'parse_shortcodes'),          9 );
		add_filter( 'mce_external_plugins',         array(&$this, 'add_tinymce_plugin') );
		add_filter( 'tiny_mce_version',             array(&$this, 'break_tinymce_cache') );
		add_filter( 'the_editor_content',           array(&$this, 'decode_shortcode_contents'), 1 );
		add_filter( 'content_save_pre',             array(&$this, 'encode_shortcode_contents'), 1 );
		add_filter( 'save_post',                    array(&$this, 'mark_as_encoded'),           10, 2 );
		add_filter( 'plugin_action_links',          array(&$this, 'plugin_action_links'),       10, 2 );

Leave a Reply

  • 2009: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  • 2005: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec