WordPress 6.1 was released only few days ago. This new update brings huge improvements from both editor/designer and development perspectives, enhancing the loved-hated-(really-hated) Block Editor (aka Gutenberg) and at the same time boosting WordPress performances by implementing a new persistent object cache layer that automatically intercepts and saves any WP_Query instance.
WP_Query cache and WPML
The new WP Object Cache for WP_Query changed the way the queries are handled within the class itself. That said, it was expected to bring a varying impact on all those plugin making use of WP_Query filters: one above all, WPML. WordPress MultiLingual uses filters to provide translated content according to its multiple-layered set of settings.
Unfortunately, the current versions for WPML Multilingual CMS and String Translation plugin in the production branche weren’t ready for the (literally) breaking changes occurred in WordPress 6.1.
In other words, updating a WPML-based website to WordPress 6.1 without the proper cautionary measures, would lead to a fatal error like the one below:
PHP Fatal error: Uncaught Error: Call to undefined method WP_Textdomain_Registry::reset() in /wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php:139 Stack trace: #0 /wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php(119): WPML\ST\MO\Hooks\LanguageSwitch->resetTranslationAvailabilityInformation() #1 /wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php(73): WPML\ST\MO\Hooks\LanguageSwitch->changeMoObjects('en_US') #2 /wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php(48): WPML\ST\MO\Hooks\LanguageSwitch->switchToLocale('en_US') #3 /wp-includes/class-wp-hook.php(310): WPML\ST\MO\Hooks\LanguageSwitch->languageHasSwitched('en') #4 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_fi in /wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php on line 139
The WPML team was already aware of the issue, as such problems were anticipated in a mail send to all plugin’s subscribers (as WPML is a subscription-only plugin). Anyway, these kind of warnings easily get ignored, so many people updated anyway.
Avoid the issue before updating to WordPress 6.1
The WPML team instructions published here as – as it happens – hasty, rough but effective. The first step, however, it’s omitted, as you need to move updates on the beta channel, otherwise you’ll see no available version coming up.
This is far from ideal, as it implies they know betas still have more testing needed, otherwise they would just move the betas on the production channel, to make them available without bothering everyone.
However, we’re not discouraged that easily.
WPML: how to activate beta updates
To activate beta channel updates, follow the steps below:
- Login to wp-admin and navigate to Plugins > Add New
- Now select the Commercial tab
- Fin the Updates Channel dropdown and select Beta
You’ll end up seeing the new versions available: just update String Translation to 3.2.3 and WPML Multilingual CMS to 4.5.12.
Please consider that:
- Transition to the beta channel is temporary: updates will default to Production after the update
- Transition to the beta channel is only possible if there are beta available, otherwise you just won’t see the dropdown
- The installed betas will be replaced by a production version as soon as it’s available
Now you can update to WordPress 6.1 without issues.
Fix the issue after updating to WordPress 6.1
If you already updated to WordPress 6.1 the website frontend will be broken, while wp-admin may still be functional: that depends on the specific plugin set installed.
In order to fix the issue, we must delete (or rename) the WPML String Translation plugin. To do so:
- Delete or rename the WPML String Translation plugin folder in wp-content/plugins/. You can either use your hosting File Manager panel or an FTP client, at your convenience.
- The website should come back alive!
- Login into wp-admin
- Now switch to the beta channel update as explained here
Your website should be back online, updated and running!