Background of the issue:
I am trying to update DIVI to the last version. For now, the WPML Multilingual & Multicurrency plugin has been deactivated. Link to a page where the issue can be seen: hidden link
Symptoms:
PHP Fatal error Uncaught TypeError: WP_Translation_Controller::translate(): Argument #1 ($text) must be of type string, array given, called in /home/customer/www/centrourku.org/public_html/wp-includes/l10n/class-wp-translations.php on line 144 and defined in /home/customer/www/centrourku.org/public_html/wp-includes/l10n/class-wp-translation-controller.php:263
Questions:
How can I resolve the PHP Fatal error related to WP_Translation_Controller::translate()?
Is there a compatibility issue between the latest version of DIVI and WPML Multilingual & Multicurrency plugin?
Message from DIVI:
On another inspection, I found that as long as the plugin WooCommerce Multilingual & Multicurrency is active, we get a critical error on the frontend.
So I've disabled that plugin for now. You can reach out to the author of the plugin to get some insight from them on this critical error.
This rule disables the XML-RPC requests, so if any plugin or theme is using this feature to communicate with your site, they won't be able to do so.
Can you please check with the WPML team and see if they are using this API for their WooCommerce Multilingual & Multicurrency plugin? Is there any other problem you're facing right now apart from that plugin causing critical error?
Thank you for contacting WPML support, I’m happy to help you with this issue.
According to the error message, I see it is related to a WordPress class WP_Translation_Controller, it is called in WooCommerce Multilingual file wp-content/plugins/woocommerce-multilingual/classes/MO/Hooks.php
to load/unload a text-domain. I think it isn't affected by XML RPC code in the .htaccess file. Does the issue persist if you remove that code?
If yes, I suggest you enable a minimal environment as below and see how it goes:
- Deactivate all plugins except WPML plugins, WooCommerce.
- Activate WooCommerce Multilingual.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
Two months ago I reported another problem with WPML String Translation:
Problem:
The client was experiencing a fatal error after updating to PHP 8.1, which suggested that the plugin was trying to use "isset" with an array instead of an object.
Solution:
We identified this as a known issue and provided a workaround. We recommended adding the following code to the theme's functions.php file after making a full backup of the site:
Now the problem is with the plugin WooCommerce Multilingual & Multicurrency. I have to turn it off beacause there a conflict with the last version of DIVI (Versión: 4.25.2).
XML RPC code isn't affecte the proper functioning.
I have created a test environment and left the WMPL and Woocommerce plugins in place. You can see this error in the screemshot.
Login to the test environement: hidden link
[supporter removed]
I would like to request temporary access (wp-admin and FTP) to your staging site to take a better look at the issue. Your next reply is set to private to share the info.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup: https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme to change configurations on the site if needed. This is also a reason the backup is critical.
The admin account isn't correct, I'm not able to access your staging site admin area. After restoring your site on my local host with a backup file, activating WooCommerce Multilingual plugin, I see there is a fatal error in the log:
[26-Jun-2024 01:41:51 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to WP_Translation_Controller::translate() must be of the type string, array given, called in /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translations.php on line 144 and defined in /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translation-controller.php:263
Stack trace:
#0 /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translations.php(144): WP_Translation_Controller->translate(Array, '', 'woocommerce')
#1 /Applications/MAMP/htdocs/centrourku/wp-includes/l10n.php(195): WP_Translations->translate(Array)
#2 /Applications/MAMP/htdocs/centrourku/wp-includes/l10n.php(306): translate(Array, 'woocommerce')
#3 /Applications/MAMP/htdocs/centrourku/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-wc-gateways.php(156): __(Array, 'woocommerce')
#4 /Applications/MAMP/htdocs/centrourku/wp-content/plugins/woocommerce-multilingual/classes/PaymentGateways/BlockHooks.php(36): WCML_WC_Gateways->get_translated_gateway_string(Array in /Applications/MAMP/htdocs/centrourku/wp-includes/l10n/class-wp-translation-controller.php on line 263
it is related to the payment gateway "Mi Cuenta Web" on your site. Then I use the code in the previous ticket, add it to the file functions.php in the child theme folder and the site works properly in the frontend.