Background of the issue:
I am trying to: After updating the following plugins I get a critical error when trying to switch languages on the site:
- SitePress Multilingual CMS from 4.6.10 to 4.6.13
- WPML String Translation from 3.2.11 to 3.2.14
- Gravity Forms Multilingual from 1.7.2 to 1.8.2
- Advanced Custom Fields Multilingual from 2.0.5 to 2.1.4.2
- Advanced Custom Fields PRO from 6.2.9 to 6.3.6
- Yoast SEO from 22.5 to 23.4
Link to a page where the issue can be seen:
To resolve this, I changed line 37 in sitepress-multilingual-cms/classes/wp-core-hooks/post/class-wpml-remove-pages-not-in-current-language.php from:
Symptoms:
PHP Fatal Error in sitepress-multilingual-cms/classes/wp-core-hooks/post/class-wpml-remove-pages-not-in-current-language.php:37
I expected to see: I expect to see the translated version of the page.
Instead, I got: In debug.log I get the following when I try to switch languages on my site:
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /app/wordpress/wp-content/plugins/sitepress-multilingual-cms/classes/wp-core-hooks/post/class-wpml-remove-pages-not-in-current-language.php:37
Questions:
Why am I getting a PHP Fatal Error after updating the plugins?
Is my solution to change line 37 in sitepress-multilingual-cms/classes/wp-core-hooks/post/class-wpml-remove-pages-not-in-current-language.php correct?