0

When I go to add a post or page to my WordPress site, the permalink and featured image are already populated with a 10 year old post, thus we are unable to create new content.

Recent changes done on the site:

  • We ran a find-and-replace in wp_posts to rebrand part of our company, however that should only have affected that string inside <p> tags since our search included spaces
  • We deleted old post revisions from the database to make it lighter
  • We ran a database cleanup plugin

I know one solution will be to rollback the database before these changes were made, but this bug was only discovered now (a week later), so recovering from the error is preferable.

  • Whats the URL in the address bar? Does it match the URL of the add new button? Are you using the Block editor? Classic editor? A page builder plugin? Have you disabled all plugins then re-enabled them one by one to identify the culprit? Any info you can add to your question would be helpful – Tom J Nowell Feb 5 at 0:10
0

Turns out that a previously-modified line in the Yoast SEO source code had been reverted, so this error came back in debug.log: 1Uncaught TypeError: Argument 2 passed to WPSEO_Link_Watcher::save_post() must be an instance of WP_Post, null given.

Disabling Yoast resolved the New Page/Post error, however I believe the root cause was that the database has been around for a few versions of WordPress and needs to be rebuilt soon for better stability (just like re-installing Windows after a couple years).

EDIT: So the root cause was that at some point wp_posts lost its primary key and had auto-increment disabled on ID, so new DB entries were all getting an ID of 0. Then, when we tried to restore the backup of that database snapshot, we received import errors because of the duplicate ID entries, causing an incomplete database restore. Once we removed the extra ID 0 entries we were able to properly import our database backup and get the site to its former glory.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.