Passer au contenu Passer à la barre latérale

Ce sujet est résolu. Voici une description du problème et de la solution.

Problem:
If you're experiencing a PHP Fatal error where an object of class WP_Error could not be converted to a string, and it's causing your website to malfunction or your menu to disappear, this might be due to an empty field in your ACF options that your theme is not handling correctly.

Solution:
We recommend checking the ACF options fields in your WordPress admin area. For the client in question, setting a value for the "Continent" field resolved the issue. Here's an example of the error log that was addressed:

[05-Mar-2024 06:57:17 UTC] PHP Fatal error:  Uncaught Error: Object of class WP_Error could not be converted to string in /home/.../header.php:125

Ensure that all required ACF fields have a value to prevent the theme from triggering a fatal error.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.

Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.

Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.

Marqué : 

Ce sujet contient 3 réponses, a 2 voix.

Dernière mise à jour par Bruno Kos Il y a 1 année et 4 mois.

Assisté par: Bruno Kos.

Auteur Messages
mars 1, 2024 à 9:05 pm #15364961

Anatole Planteur

Hello

Our website giving that error since couple of day, we tried everything :
Reinstall wp ; reinstall wpml, clean all WPML cache, string we tried that https://wpml.org/errata/php-fatal-error-uncaught-error-object-of-class-wp_error-could-not-be-converted-to-string/ (but didnt worked, is blocked). We duplicate that site on a dev instance, we getting that error

[proxy_fcgi:error [pid 308736:tid 140590721169152 [client 96.23.248.181:0 AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in /home/12232............-header.php(19): require_once('/home/1223206.c...')\n#6 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/index.php(17): require('/home/1223206.c...')\n#7 {main}\n thrown in ...', referer: lien caché

lien caché

Alos look like the menu completely disapear from the menu.

mars 4, 2024 à 8:24 am #15367917

Bruno Kos
Partisan de WPML depuis 12/2018

Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français )

Fuseau horaire: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Would you be willing to provide me with WordPress and FTP credentials so I could investigate the issue directly?

Can you also install https://wordpress.org/plugins/pexlechris-adminer/?

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

I marked your next reply as private so that you can safely add credentials.

Regards,
Bruno Kos

mars 4, 2024 à 4:30 pm #15371229

Bruno Kos
Partisan de WPML depuis 12/2018

Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français )

Fuseau horaire: Europe/Zagreb (GMT+02:00)

I get "Erreur : l’identifiant dad***nerk n’est pas inscrit sur ce site. ", can you check?

mars 5, 2024 à 2:24 pm #15374985

Bruno Kos
Partisan de WPML depuis 12/2018

Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français )

Fuseau horaire: Europe/Zagreb (GMT+02:00)

I set "Latin America" on lien caché and it works now lien caché.

So within Continent field. It was that, this field was empty and your theme doesn't handle missing value from ACF options, instead hitting a fatal error.

[05-Mar-2024 06:57:17 UTC] PHP Fatal error:  Uncaught Error: Object of class WP_Error could not be converted to string in /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-content/themes/aime/header.php:125
Stack trace:
#0 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-includes/template.php(790): require_once()
#1 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-includes/template.php(725): load_template()
#2 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-includes/general-template.php(48): locate_template()
#3 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-content/themes/aime/aime-actions.php(11): get_header()
#4 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-includes/template-loader.php(106): include('/home/1223206.c...')
#5 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-blog-header.php(19): require_once('/home/1223206.c...')
#6 /home/1223206.cloudwaysapps.com/kegznthavv/public_html/index.php(17): require('/home/1223206.c...')
#7 {main}
  thrown in /home/1223206.cloudwaysapps.com/kegznthavv/public_html/wp-content/themes/aime/header.php on line 125
mars 5, 2024 à 2:38 pm #15375059

Anatole Planteur

AMAZIING !! that was really idiot, im so sorry for that. Dev team will check that error management right away. 10000x thanks !