Blog Fix: HemingwayEX and WordPress 2.3

In General, Open Source, Softwareby Michael Sheehan34 Comments

Last night I upgraded to the latest version of WordPress 2.3. See my previous posts (here and here) for more information. However during the upgrade process, I found an incompatibility with the new Category and Tagging functions and the theme I was using (HemingwayEX). On my homepage, I was getting the following error:

WordPress database error: [Table ‘weblog_td.wp_categories’ doesn’t exist] SELECT cat_ID FROM wp_categories WHERE cat_name=’Asides’


This error was also appearing when using the HemingwayEX Asides module in my Sidebar. Luckily I had a local copy of my blog running on my laptop and I was able to figure out the differences between the two databases and the tables and fields therein. So, I have posted my results for the benefit of those users who have HemingwayEX as their theme.

In order to fix the code to make things work, this is all that you need to do:

  1. Find, (Download), Open and Edit the “functions.php” file which resides in the “HemingwayEX” folder in the “themes” folder
  2. Locate line 133 (or somewhere near that) that reads:

    return $wpdb->get_var(“SELECT cat_ID FROM ” . $wpdb->categories . ” WHERE cat_name='” . $hemingwayEx_options[‘asides_category’] . “‘”);

  3. Change that line to read as follows (and note, I commented out the old line so that I could always roll it back; you can comment it out by adding two forward slashes “//”):

    return $wpdb->get_var(“SELECT term_ID FROM ” . $wpdb->terms . ” WHERE name='” . $hemingwayEx_options[‘asides_category’] . “‘”);

    Note: you may need to change the quotation marks if you cut and paste from this entry. Simplly highlight the quote marks and enter them again using your keyboard.

    • The database items that changed are (pre-2.3 –> post 2.3):
      • cat_ID –> term_ID
      • categories –> terms
      • cat_name –> name
  4. Save your changes to the “functions.php” file and save to your blog theme directory. That’s it!

This worked fine for me (so far). The error disappeared from my homepage and my HemingwayEX Asides Sidebar module started working properly again. Hope this works for you!

HTD Says: “Hack” your functions.php page to make the HemingwayEX theme and WordPress 2.3 work in synergy!