This coming Monday, March 7th, we’ll be releasing Genesis 2.2.7 to fix some issues with WordPress compatibility, as well as fix an issue with term meta performance.
UPDATE: To give developers more time to prepare their plugins and sites, we will NOT be introducing the breaking change, outlined below, in Genesis 2.2.7. Instead, we will push it to Genesis 2.3.0. Genesis 2.2.7 will still release on Monday, March 7th, to address other bugs.
If you have built a plugin that relies on the Genesis term meta system in order to function, it’s incredibly important that you prepare your plugin for Genesis 2.2.7 2.3.0. If your plugin relies on Genesis to store and serve term meta, you will very likely receive messages from your users saying that it’s no longer working.
Why is Genesis dropping support for the old style of term meta?
Normally, we do everything we can to maintain backward compatibility, which is exactly what we did with Genesis 2.2.6. Even after the conversion to the official WordPress term meta method, we still pulled and injected a term’s metadata into the term object variable, so it could be accessed using the old method.
Unfortunately, some users reported that this was performing quite poorly on pages where many terms appeared. For every term that was queried on the page, the entirety of its term meta was also queried. Do this for a few dozen terms, and you can see how the number of queries could quickly get out of hand.
And frankly, this was always a problem with Genesis term meta. It simply didn’t scale to larger sites that used anything more than a few terms with metadata.
To use a metaphor, we were emptying the pitcher to pour a glass of water. Not efficient at all.
Which is why we switched to the more official method.
With the official method, we’re able to only pull the data we need at the time we need it. It’s also run through the WordPress caching system, which adds another layer of efficiency.
Put shortly, it’s better in every way. But it’s implemented in a way that is, unfortunately, incompatible with the previous method we used in Genesis.
So, we’re forced to choose, and I chose to go with the better, more efficient method.
Will this break my plugin?
To be clear, nothing should error out or make a site whitescreen. It’s not that kind of breaking change.
What will happen is this: if your plugin tries to use stored metadata by accessing the $term
object, looking at the $term->meta
array, it won’t find anything. That array is now empty (but does still exist).
For example, in Genesis Simple Sidebars, we look at this array to see if a term’s archive page should use a custom sidebar.
As of Genesis 2.2.7 2.3.0, that array will be blank, so the chosen sidebar won’t be used.
So, I’ve updated Genesis Simple Sidebars to account for this. You can see that the calls are much simpler now, and this is not a difficult change to make. But it must be made in order for your plugin to continue to function properly.
Do I have to convert the data?
No. When Genesis updated to 2.2.6+, the old data was converted for you. You just have to switch methods for accessing the data.
So, what do you need to do?
For most of you who build Genesis plugins, you won’t need to do anything. This is only for plugins that use the Genesis term meta implementation … so, VERY few of you.
But for those of you who do, instead of accessing term metadata like this:
$term->meta['term-meta-key']
You’ll access it like this:
get_term_meta( $term->term_id, 'term-meta-key', true )
You’ll want to do this everywhere term meta is used, including on the edit screen when you give the input fields their values.
It’s also a good idea to go ahead and bump the minimum requirements for your plugin up to WordPress 4.4 or greater so that people don’t get “function doesn’t exist” errors. And if you place Genesis version requirements on your plugin, bump that to Genesis 2.2.7 2.3.0 as well.
Please have the update ready to release by Monday, March 7th.
I am here to help!
If you need me to review your modifications, or would like help updating your plugin to the new method, I’m happy to help. I understand this is an inconvenience, but I promise it’s worth it.
Contact me on Twitter @nathanrice and let me know what you need.