New Plugin Detects Shared Terms in WordPress Ahead of Taxonomy Term Splitting in 4.2

photo credit: Utičnice - (license)
photo credit: Utičnice(license)

Taxonomy term splitting in WordPress 4.2 addresses a seven-year-old bug that occasionally posed a nuisance to developers. In the past, WordPress allowed terms to be shared between multiple taxonomies. This caused a problem where updating a shared term would change the others unintentionally.

Boone Gorges’ progress on this ticket marks a major milestone on the taxonomy component roadmap that Andrew Nacin outlined in 2013. Splitting shared terms paves the way for more exciting improvements to taxonomy meta and post relationships in the future.

Gorges explained how taxonomy term splitting will work in 4.2:

WordPress will detect whether the term is shared between multiple taxonomies, and if so, will create a new row in wp_terms for the updated term and change all necessary term_taxonomy associations. term_taxonomy_id will stay the same, but term_id will change. This is a case of a shared term being split into separate terms.

In most cases, term splitting will go unnoticed. However, there are some plugins and themes that store term IDs as static data. In these cases, a changed term ID has the potential to cause various sorts of problems.

He identified 11 out of the top 100 plugins on WordPress.org that will be affected by this change in 4.2, due to the fact that they store term IDs independently in the database. Plugin authors are advised to update their extensions to facilitate split term ID migration, and Gorges offers an example in his post on the Make/Core blog.

Find out if your WordPress site is using any shared terms.

Shared terms are extremely uncommon. However, if you’re curious to find out if your site has any, the new WP Find Shared Terms plugin makes it easy to detect shared terms and will list them along with their associated taxonomies.

After installing it, you can visit Tools > Find Shared Terms to see a list. I tested it and found that it works as advertised to detect shared terms, their IDs, taxonomies, and associated posts:

shared-terms

The plugin was created by Josh Eaton, Partner at Reaktiv Studios. Eaton developed it to help users plan ahead for upcoming taxonomy changes.

“This may be helpful in determining whether you need to refactor any custom code that stores term IDs or upgrade any of your plugins prior to the 4.2 upgrade,” he said. “If your site doesn’t have any shared terms, and you’ve already upgraded to 4.1 then you’re in the clear!”

Eaton said even if you detect that your site has shared terms, it doesn’t necessarily mean that you’ll have a problem updating. Detecting shared terms should prompt you to check that the plugins you’re using are properly updated for 4.2.

It’s important to note that shared terms in WordPress 4.2 will not be retroactively split, but will only be split if the terms are updated in the dashboard, i.e. renamed, etc. Gorges advises that there are plans to force all shared terms to be split in a future release. It’s prudent to plan ahead now. If you suspect that you might have an issue with shared terms, install the WP Find Shared Terms plugin as a first step and monitor your WordPress plugins for updates ahead of the 4.2 release.

4

4 responses to “New Plugin Detects Shared Terms in WordPress Ahead of Taxonomy Term Splitting in 4.2”

  1. Thanks for the post, Sarah. Just one additional note: Josh’s tool, and really the whole shared/split terms discussion, is aimed at developers. WordPress users do not, and should not, need to worry about this at all. The onus is primarily on plugin authors to do the necessary cleanup. The main purpose I see for Josh’s plugin is for developers who have built custom sites to see whether they even need to bother dealing with shared terms on those custom sites.

    • Boone – I agree that it’s definitely more for developers. But then I think about some users who have a bunch of commercial plugins installed where the plugin author isn’t very tuned in to keeping up with WP core development and who may not be updating with taxonomy term splitting in mind. I thought maybe regular users might help raise awareness with plugin devs who are tuned out. Even if it’s simply by bugging them to say, “Hey is this going to be compatible with 4.2 taxonomy changes?” :)

  2. I think this information IS useful for end users for the reason that some developers may bail out of supporting an aged plugin and won’t leave any way to contact them. I posted this to WordPress.org several hours ago but thought I might get a quicker answer here:

    I started using this now unavailable plugin over 3 years ago:
    https://wordpress.org/support/topic/plugin-wp-render-blogroll-links-custom-order .

    It created Term ID numbers which it used to maintain Categories of Links.
    With it , I also used these two additional plugins:
    https://wordpress.org/support/view/plugin-reviews/link-manager
    https://wordpress.org/plugins/hierarchical-link-categories/

    After uninstalling ALL 3 of the above plugins from my main site, I ran this search plugin I learned about on WP Tavern: https://github.com/jjeaton/wp-find-shared-terms . It informs me that I have mixtures of the following:

    Term Taxonomy ID=126, Term ID=20, Name=All, Taxonomy=Link Categories, Number of Posts=0

    Term Taxonomy ID=20, Term ID=20, Name=All, Taxonomy=Categories, Number of Posts=0

    I believer that the Hierarchical Link Categories create the “All” name back some time ago, and I can’t seem to get rid of it. Also, I believe that somewhere in my Database is a list of ID Numbers created by the WP Render Blogroll Links plugin which is now deleted. How do I find any possibly hidden list of Category Term ID numbers in my Database so I can delete them all individually (am I correct that this might be the reason I still have an “All” name?

    (Additional Information: I have created NO Posts on my main site…I use it for a display of only Pages and Links.)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Discover more from WP Tavern

Subscribe now to keep reading and get access to the full archive.

Continue reading