(RUFW)

RMRH Update for WP 2.8.1

July 16, 2009 @ 22:28:34

I had to update the Read More Right Here plugin for the recent 2.8.1 Wordpress release (details below). The most important item to note is that now the minimum required version of WP is 2.8.

Details, Details

I previously was calling a function I wrote to set the URL to the plugin root directory. This was then used to register the script with WP and was also passed down to the javascript using wp_localize_script.

The one-liner function:

function wt_rmrh_getBasePath()
{
    return get_bloginfo('wpurl') . "/" . PLUGINDIR . "/" . plugin_basename("read-more-right-here/");
}

With the 2.8.1 update, the above no longer worked. Before 2.8.1, the path in a page’s header was (in part):

   plugins/read-more-right-here/js/wt_rmrh.js

After the 2.8.1 update, the path became:

   plugins/read-more-right-herejs/wt_rmrh.js

Needles to say, that javascript file isn’t going to load.

I looked through wp-includes/plugin.php and found the plugin_dir function which

Gets the URL directory path (with trailing slash) for the plugin __FILE__ passed in

(their function comment).

So I deleted the function (which was only being called once) and replaced

$pluginUrl = wt_rmrh_getBasePath();

with

$pluginUrl = plugin_dir_url(__FILE__);

Everything seems to be in working order now. At least until the next Wordpress version!

11 Comments

Follow Comments