Critical error when clearing cache for all languages (WPML)

Symptoms of the problem:

A critical error occurs when clearing the cache using WP Rocket's admin bar menu: Clear CacheAll languages

The error is caused by the WPML plugin and it is reported on the WPML forum here: https://wpml.org/forums/topic/reset-cache-wp-rocket-all-languages-fatal-error/

Confirm this is the same issue by enabling WordPress’s debugging:
WP_DEBUG: Enable error logging in WordPress

The error you would see there is:

Fatal error: Uncaught TypeError: Argument 1 passed to WPML\Element\API\Languages::WPML\Element\API\{closure}() must be of the type array, bool given in .... /wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/core-api/core/Languages.php:205 
Stack trace: #0 [internal function]: WPML\Element\API\Languages::WPML\Element\API\{closure}(false) 
#1 ...... /wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(152): call_user_func_array(Object(Closure), Array) 
#2 [internal function]: WPML\Element\API\Languages::WPML\FP\{closure}(false) 
#3 ......../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Traits/Macroable.php(56): call_user_func_array(Object(Closure), Array) 
#4 ..../wp-content/plugins/sitepress-multilingual-cms/classes/user-language/class-wpml-user-language.ph in ...../LiveTube/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/core-api/core/Languages.php on line 205

Solution:

Try the solution provided in the forum thread to resolve the problem:

  • Set the administrators language in the profile page to “default”.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.