Title: Categories corrupted
Last modified: March 4, 2020

---

# Categories corrupted

 *  [cornelius25](https://wordpress.org/support/users/cornelius25/)
 * (@cornelius25)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/categories-corrupted/)
 * I have an issue with post categories not having a checkbox next to them so they
   cannot be deleted.
    There are duplicates of the same categories. If I open a 
   post and select one of the corrupted categories, the checkboxes next to ALL of
   the corrupted categories select at once. Some of the corrupted categories are
   woocommerce related. Under woocommerces, product categories these categories 
   are not listed, only the default uncategorized. Any suggestions to repair the
   categories?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/categories-corrupted/#post-12510025)
 * Ideally, restore your DB from a backup made before the categories became corrupted.
   The problem is you’ll lose anything changed after the backup was made.
 * How did they become corrupted? You need to ensure it doesn’t happen again. If
   a lot of data is involved, repairing it again and again may not be trivial. How
   many category terms are involved? And how many posts/products need the problem
   terms assigned? Correcting a large amount of data will be time consuming.
 * A possible solution is to correct the DB directly with the phpMyAdmin app. It’s
   easier to remove the data than to attempt to patch it. Once removed and you know
   it will not happen again, you can re-enter the terms and assign them to posts/
   products again.
 * There are 3 or 4 tables involved with taxonomy terms. This requires understanding
   how they interrelate in order to correctly remove the offending terms without
   further corrupting the data. The understanding can be gained by studying the 
   tables in phpMyAdmin. Be sure to make a backup of all affected tables before 
   making any changes. It’s not difficult to make things worse instead of better
   even if you know what you’re doing. This is not a task to take lightly. Consider
   carefully if this is something you want to take on.
 *  Thread Starter [cornelius25](https://wordpress.org/support/users/cornelius25/)
 * (@cornelius25)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/categories-corrupted/#post-12517669)
 * I’ve looked at the database and discovered that all the corrupted categories 
   have a term_id of 0.This is the case under terms, term_taxonomies and term_relationships.
   Changing the term id of one of the corrupted terms causes them to no longer show
   on the list of categories in wordpress’s categories section.
    I do not know how
   the database became corrupted, this was a pre-existing site I took over management
   of for a client.The first corrupted categories are related to woocommerce, so
   it looks like that is when the issue began. Unfortunately because it looks like
   the problem began some time ago, a database restore will not solve the issue.
   It looks like a rebuilding of the affected database sections will need to be 
   done to resolve it.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/categories-corrupted/#post-12519505)
 * Wow, that’s strange. Hopefully it was a one time occurrence and some plugin is
   not actively corrupting things. If the problem terms all have IDs of `0`, at 
   least it’ll be easy to construct queries to remove the data. The difficulty would
   be in re-assigning the terms to the objects to which they belong.
 * If the object to term relationship is still apparent despite `0` ID, I suppose
   it’s conceivable to reconstruct the data using new, unused ID values. The next
   available ID in the terms table can be determined from the auto increment field
   under table options (operations tab). Increment the field value for every ID 
   you use. If there are only a few terms to repair this is feasible to do manually.
   If it’s a large number, maybe the logic to repair the data can be captured in
   a script that does the repairs.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Categories corrupted’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/categories-corrupted/#post-12519505)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
