Getting the WP-Syntax plug-in to work in WordPress 2.0.x

Plugin
Vintage socket photo by porah

I was looking for a WordPress plugin for code syntax highlighting that would work in the legacy WordPress 2.0 branch and discovered WP-Syntax which promised to do the trick.

The system requirements say

  • Requires WordPress Version: 2.0 or higher
  • Compatible up to: 2.7

Except that when installed on a WordPress 2.0.11 installation it threw up an error:

Fatal error: Call to undefined function do_action_ref_array() in \blog\wp-content\plugins\wp-syntax\wp-syntax.php on line 106

Tweaking required

It looks like that plugin doesn’t work in WordPress 2.0.x without a little tweaking. The exceptional WordPress Codex came to the rescue — if only all content management system documentation was that good.

This function is identical to do_action

So I tweaked the code and removed:

do_action_ref_array('wp_syntax_init_geshi', array(&$geshi));

and replaced it with

do_action('wp_syntax_init_geshi', array(&$geshi));

and lo and behold it worked!