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.
ALTER TABLE wp_terms AUTO_INCREMENT = 1
then. Please note that it will set auto increment to 1, which means that you will need to re-enter every term you have in that table or any other term and taxonomy related tables. It will probably break the connections. Safest way would be to delete all the terms and taxonomies from admin area and then run this code in SQL from phpMyAdmin. Repeat this code with every table related to taxonomies and terms (just change the table name in code).ALTER TABLE wp_terms AUTO_INCREMENT = X
but take the highest ID inwp_terms
table, add 1 to it (e.g highest ID is 83, add 1 to it and you get 84) replace the X with that value (84 in our example). Do not forget to backup your database if data is important!