Divi Theme: Object of class WP_Post could not be converted to string
Issue
If you’re using a Divi website and randomly experience an issue such as “There has been a critical error on this website”, there’s a high chance that the et_divi option is corrupted.
Below is a quick solution to fix it
Investigation
Follow the prompts below:
- Firstly, go into the Staq Panel for the site in question and click Debug.
- Then, Enable Debug.
- Then, click WordPress tab
- Go back to the WordPress site > Appearance > Themes and try to generate the error message. You will either generate the error message by clicking Themes or by activating Divi
- Go back to Staq Panel and click Refresh under the WordPress logs tab
If you see this same issue, then the solution below will assist:
In summary, the issue is this Uncaught Error: Object of class staClass could not be converted to string
Solution
Go to the Plugins list and install Code Snippets.
Then, open the plugin and create a snippet and paste this code:
$empty = array();
update_option(‘et_divi’, $empty);
Make sure you Save Changes and Activate the snippet:
Clear Divi Cache
Soon after, clear the Divi cache if static CSS has been applied by going to Divi > Builder > Advanced and click Clear if Static CSS File Generation is Enabled:
After that, confirm if the Divi theme loads.