Spring Sale! Save 30% on all books w/ code: PLANET24
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.

About the Author
Jeff Starr = Designer. Developer. Producer. Writer. Editor. Etc.
The Tao of WordPress: Master the art of WordPress.
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 »
Banhammer: Protect your WordPress site against threats.
Thoughts
I live right next door to the absolute loudest car in town. And the owner loves to drive it.
8G Firewall now out of beta testing, ready for use on production sites.
It's all about that ad revenue baby.
Note to self: encrypting 500 GB of data on my iMac takes around 8 hours.
Getting back into things after a bit of a break. Currently 7° F outside. Chillz.
2024 is going to make 2020 look like a vacation. Prepare accordingly.
First snow of the year :)
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.