Updating failed. Could not update in the database
Joe
October 25, 2022
You're probably looking at this post because you've seen the error message on a Wordpress site.
I came across this recently while doing some work for a client. There are several ways to fix it. The first is to manually recreate each page from scratch. I started doing this, thinking it was something to do with the Gutenberg block editor. But I got frustrated, I didn't want to go through 50 odd pages and make this correction manually.
I decided to look at the database itself to see if I could work out what the problem was. It turned out that the post meta table contained duplicate entries—where a single post had the same value.
I found this site (Use Wordpress) which helped me drill down into the data, and identify problem posts. Reproducing below in case it ever goes offline.
If you think you might have this issue, run the following SQL query:
If you have results, then you should back up your database, and then run the following:
With a bit of luck, your problem will be solved.
Discussion in the ATmosphere