New Bookstore! Save 20% on books with discount code: LAUNCH
Web Dev + WordPress + Security

New Version of Category LiveBookmarks Plus for WordPress 2.3

Category LiveBookmarks Icon
CLB+
As many WordPress users now realize, there have been many fundamental changes in the new version of WordPress. The latest version of WordPress — 2.3 — features a considerably revamped database structure, including a complete reorganization and redistribution of the wp_categories table. Unfortunately, such database alterations have rendered inoperable many popular plugins, proving quite unfortunate not only for millions of WordPress users, but also for those of us who donate time, effort, and resources toward the development of freely available WordPress plugins.

Tough decisions

Thus, with the advent of WordPress 2.3, developers whose plugins have ceased to function must now decide whether or not to continue their support. In my humble opinion, philanthropic plugin developers have several choices:

  • Continue plugin support by sacrificing additional time and resources for yet another questionable WordPress upgrade.
  • Discontinue plugin support for WordPress 2.3 and the potentially infinite number of impending WordPress upgrades.
  • Drop WordPress completely and embrace a less-ambitious, more-stable blogging/CMS platform.

..and not necessarily in that order ;) Nonetheless, I remain an ardent supporter of WordPress, and will continue supporting my plugins (and themes, for that matter) for as many WordPress upgrades as I can stomach. For now, although I refuse to upgrade Perishable Press to WordPress 2.3, I have taken the time to install and configure a special 2.3 “test site” for the purpose of testing and upgrading my favorite plugin, Category LiveBookmarks Plus, which is (as far as I know) the only one of my five plugins that was broken by WordPress 2.3. As suspected, the restructuring of the wp_categories table made it impossible for CLB+ to query and process the data required for it to function.

Working solution

After investigating the new database structure of WP-2.3, I noticed several changes needing addressed in order to restore proper CLB+ functionality. Specifically, WordPress 2.3 employs the following database changes:

  • categories is now terms
  • cat_ID is now term_ID
  • cat_name is now name

Following the implications of these changes to the old version of the CLB+ plugin, we notice the sudden ineffectiveness of the core database query:

$query  = "
	SELECT cat_ID, cat_name, category_count, category_nicename, category_description, category_parent
	FROM $wpdb->categories
	WHERE cat_ID > 0 AND category_count > 0 AND category_parent = 0
	ORDER BY cat_ID ASC
";

That works fine for all pre-2.3 WP-versions, but needs to be completely rewritten in order to work properly with WordPress 2.3 (and subsequent versions):

$query = "
	SELECT * FROM $wpdb->term_taxonomy 
	JOIN $wpdb->terms ON ( $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id ) 
	WHERE $wpdb->term_taxonomy.taxonomy = 'category' 
	AND $wpdb->terms.term_id > 0 AND count > 0 AND parent = 0 
	ORDER BY $wpdb->terms.term_id ASC";
";

Fortunately, after modifying the main database query, the remaining code fell into place quite nicely. In fact, while implementing the changes required for the WP-2.3 upgrade, I found myself rethinking and rewriting a large portion of the CLB+ script. The new plugin functions flawlessly with WordPress 2.3, requires fewer system resources, and generates improved (X)HTML markup. The overall result is the cleaner, faster, more efficient generation of a completely customizable set of category and feed links.

To download Category LiveBookmarks Plus, visit the CLB+ homepage.

Jeff Starr
About the Author
Jeff Starr = Creative thinker. Passionate about free and open Web.
WP Themes In Depth: Build and sell awesome WordPress themes.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
USP Pro: Unlimited front-end forms for user-submitted posts and more.
Thoughts
Take a screenshot with Firefox (no extension required). Open Developer Tools Settings and enable the “Take a screenshot” button. Then click the button :)
Take a screenshot with Chrome (no extension required). Open DevTools, type Cmd + Shift + P, then type screenshot.
After 10 years working on my 2010 iMac, my upgrade finally arrived. Shiny new iMac shipped from Ireland :)
Too much caffeine weirds me out. But I love the taste of coffee. So once in a while I enjoy a small cup of decaf. Hits the spot.
Chris Coyier is a truly awesome person. One of the finest people I've ever worked with. Just #gottasayit
Excel won't open CSV file because SYLK format? Open it with text editor and add an apostrophe ' at the beginning of the file, save changes, done.
Displaying too many social media buttons and links all over the place imho makes you look desperate and frankly kinda sad.
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.