Could not insert term into the database

I’ve spent a fair while reading about the “Could not insert term into the database” error, but the fixes I have read (changing theme, fresh WP install, disable plugins) simply are not working.

I tried a force DB upgrade, still no joy.

Looking at wp_terms there’s a category with term_id of 0. This is mighty strange and if I delete it, I’m then able to add a category via wp-admin. However, subsequent categories then fail with the “Could not insert term into the database” message and re-checking wp_terms shows the freshly added category as id 0! This seems to suggest WP is assigning the cat a term_id of 0 every time.

Has anyone seen this? Any ideas on a fix? The database in question is pretty huge, so a rebuild would not be a pretty thing.

2 s
2

OK. There where multiple issues here;

wp_terms, wp_termmeta and wp_term_taxonomy all had their ID’s set not to AUTO_INCREMENT.

Changing these and removing the 0 values from each table seems to have resolved this – very odd though.

Big thanks to @N00b for helping!

Leave a Comment