When I want to create a new category or tag on the Wordpress site. I encountered this error.
Empty Term.
As usual, My theme and Plugins are updated. I disabled all plugins. The error was not resolved. I replaced all the Wordpress files and folders with a new version and it didn't fix the problem. I repaired and optimized the database tables and the error was not fixed. I could not disable the theme (enfold)because the site is working.
If you have experienced this error, please help me.
When I want to create a new category or tag on the Wordpress site. I encountered this error.
Empty Term.
As usual, My theme and Plugins are updated. I disabled all plugins. The error was not resolved. I replaced all the Wordpress files and folders with a new version and it didn't fix the problem. I repaired and optimized the database tables and the error was not fixed. I could not disable the theme (enfold)because the site is working.
If you have experienced this error, please help me.
Category tables damaged. Delete wp_terms table and insert them again and problem is solved.
Rename the "plugins" folder in "wp-content" and create a new empty "plugins" folder. Test if the error persists.
Temporarily revert any custom code or modifications in your theme.
Add a higher memory limit to "wp-config.php."
Use the "WP-Optimize" plugin to optimize and repair the database.
Check for error messages by enabling WordPress debugging in "wp-config.php."
Reach out to the "Enfold" theme support team for assistance.
This steps worked for me:
Step 1: Delete Records with term_id = 0 Execute the following query to delete the records with term_id = 0:
in PHPmyADMIN go to your database and run following SQL's. Don't forget to make a full db backup before you start!
DELETE FROM wp_terms WHERE term_id = 0;
Step 2: Add the PRIMARY KEY After removing the records with term_id = 0, you can add the PRIMARY KEY:
ALTER TABLE wp_terms ADD PRIMARY KEY (term_id);
Step 3: Add AUTO_INCREMENT Now you can set the AUTO_INCREMENT property again for the term_id column:
ALTER TABLE wp_terms MODIFY term_id bigint(20) unsigned NOT NULL AUTO_INCREMENT;
Step 4: Check the Changes Check if the changes are correct by running the following query:
SHOW CREATE TABLE wp_terms;
The output should now be as follows:
CREATE TABLE `wp_terms` (
`term_id` bigint(20) unsigned NOT NULL **AUTO_INCREMENT**,
`name` varchar(200) NOT NULL DEFAULT '',
`slug` varchar(200) NOT NULL DEFAULT '',
`term_group` bigint(10) NOT NULL DEFAULT 0,
PRIMARY KEY (`term_id`),
UNIQUE KEY `slug` (`slug`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Step 5: Test Insert New Term Now try inserting a new term again:
INSERT INTO wp_terms (name, slug) VALUES ('Test Category', 'test-category');
If this works successfully, the problem is solved.