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:
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.
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.