Today I accidently happend to delete my category right after I've noticed there is no trash in categories. I wonder is there any way to include trash bin for it? I've made a little research over a wordpress documentation but didn't find anything like that. Does anyone know anything about that ? Is this possible?

  • I am working on this to make a plugin for this. I will update you here when done.
    – Aftab
    Jul 22, 2016 at 15:12

3 Answers 3


This would be quite challenging to implement.

Posts can be trashed because:

  1. They have a concept of status and corresponding field in database table
  2. WordPress code "knows" to only deal with posts of appropriate status for most purposes

This solves issues of visibility (posts won't appear on front end) and interaction (trashed posts won't show up as belonging to a category and so on).

Taxonomies in general, including native categories, have no concept of status. They are always "on" until they are deleted.

Introducing concept of status to them would be extremely challenging to do cleanly. Just enumerating all the places where it would matter in core code would be a challenge. Overriding native behavior in all of those places might be straight impossible.

I could think of only one approach that could be reasonably practical: create a "virtual" taxonomy and whenever term is deleted "migrate" it to it, preserving all object assignments. Then undelete is possible by "migrating" it back to original taxonomy. Even these would probably be a lot of work to implement robustly.

  • Hi @Rarst, I am working on this to make a plugin for this. Hope I will be successfull.
    – Aftab
    Jul 22, 2016 at 19:08
  • This is basically what I suggest doing using the hook I mentioned in my answer.
    – Fencer04
    Jul 25, 2016 at 11:58

It will take a bit of programming on your side but you can use the delete_term_taxonomy hook to create a trash for the categories. It is run just before the category is deleted.

  • So basically, I can use this hook for example to display alert box after clicking delete if I'm sure about deleting the category ? Jul 25, 2016 at 11:46
  • Or you could create a trash bin by saving the category details and the IDs of the posts in the category into another post type before the delete occurs. Then display a trash just like the regular posts.
    – Fencer04
    Jul 25, 2016 at 11:57

There is a new plugin that restores the deleted categories TP Restore Categories and Taxonomies

  • Restore WordPress Categories.
  • Restore WordPress Tags.
  • Restore WordPress Custom Taxonomy.
  • Restore WordPress Taxonomy / Categories / Tags Custom Fields.
  • Restore WordPress Taxonomy / Categories / Tags ACF.
  • Restore Woocommerce Product Categories.
  • Restore Woocommerce Product Tags.
  • Restore Woocommerce Product Attributes (product variations).
  • Restore Woocommerce Taxonomy / Categories / Tags Custom Fields.
  • Restore Woocommerce Taxonomy / Categories / Tags ACF.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.