Welcome to the new design! Please report any bugs or issues, thanks :)
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 = Designer. Developer. Producer. Writer. Editor. Etc.
BBQ Pro: The fastest firewall to protect your 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 »
Blackhole Pro: Trap bad bots in a virtual black hole.
Thoughts
Checking in to anyone listening. Stay safe. Pay attention. Don't get lazy.
What's up with Plesk UI lately? Especially on Chrome it looks just awful, all kinds of broken. Come on Plesk devs get it together.
Things get stressful, I try to pray. Not always easy, but always helps to relax and regain focus.
Nice new speed checker at fastorslow.com.
Easy way to exclude certain tests from WP Site Health: Site Health Tool Manager
Excellent (and free) tool for getting tons of site SSL infos: whynopadlock.com
Everyone just stay home and hide forever. Brilliant idea.