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:

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

and replaced it with

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

and lo and behold it worked!

2 thoughts on “Getting the WP-Syntax plug-in to work in WordPress 2.0.x

  1. I wondered why you were looking for a plugin for the legacy branch until I viewed source – you still run this on 2.0?!
    Didn’t you update? At some point in the last year, I was sure you posted about upgrading to 2.4?

  2. My current web host can’t support the requirements for anything above WordPress 2.0.11

    My current host (WebFusion) offers:

    • PHP 4.3.10
    • MySQL 3.23.56

    WordPress 2.7 requires:

    • PHP 4.3 or greater
    • MySQL 4.0 or greater

    It’s let down with the MySQL support. Hence my recent tweet about looking to move to another web host.

    Technically, I could move to a different hosting package with WebFusion but I’d lose 2 databases!

    G

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>