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!

Published by

Gareth Saunders

I’m Gareth J M Saunders, 48 years old, 6′ 4″, father of 3 boys (including twins). Scrum master at Vision Ltd, Dundee. Latterly, web architect and agile project manager at the University of St Andrews and former warden at Agnes Blackadder Hall. Enneagram type FOUR and introvert, I am a non-stipendiary priest in the Scottish Episcopal Church, I sing with the NYCGB alumni choir, play guitar, write, draw and laugh… a lot.

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 to Doug Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.