I’ve just migrated to another hosting and Im getting this error when trying to create a page.
any thoughts what may be causing this error?
Hi,
From the fatal error you’ve shared, there seems to be an underlying issue within this site’s database. The specific error line “on_save_post () must be an instance of WP_Post, null given” points to an issue in the database table structure which is either corrupted or is missing key elements.
As a quick test, you may try to adding/publishing a post or page normally within WordPress’ default editor with all the plugins (including Elementor) deactivated.
If you cannot add/publish new posts/pages even with Elementor deactivated, you will need to report this fatal error to your hosting provider to check and resolve any database issues present.
For quick reference, here are a couple of web articles you may find helpful in possibly repairing a corrupted WordPress database. I’ve also included WordPress’s Database Description article which outlines the various tables, their structure, and necessary field values.
https://www.maketecheasier.com/fix-corrupted-wordpress-database-2/
https://www.alexgeorgiou.gr/repair-auto_increment-primary-key-wordpress-mysql/
https://codex.ww.wp.xz.cn/Database_Description
In most cases, if this error occurred after a site migration, this can also happen when the migration is incomplete in ensuring that the entire database and its table structures were copied exactly as they were in the original site. If this was indeed a site migration, you may try another migration tool or take a look at our Site Migration blog article that may help.
https://elementor.com/blog/site-migration/
I hope this information helped you solve your issue.