How to Restore a WordPress Category
WordPress has no Trash for categories. How to restore a deleted category from a backup or with WP-CLI, reassign its posts and fix its URL.

You cannot restore a deleted WordPress category from a Trash, because categories never go to one: clicking Delete removes the category from the database straight away. To get it back you either restore it from a backup taken before the deletion, or recreate it with the same name and slug and reassign its posts. The posts themselves are safe; WordPress only moved them to your default category.
Our team rewrote this guide on 18 November 2026. The earlier version told readers to “check the Trash tab” on the Categories screen, which does not exist, so we went back to WordPress core (version 7.1.4), read what wp_delete_term() really does, then deleted and restored a category on a test site with WP-CLI 2.12.0 to make sure every step below works.
Can you undo deleting a category in WordPress?
No. WordPress has a Trash for posts, pages and comments, but not for terms, which is the umbrella name for categories, tags and custom taxonomy terms. When you click Delete on the Categories screen, the browser shows a confirmation that reads “You are about to permanently delete these items from your site. This action cannot be undone.” It means exactly that.
People have asked for a term Trash for years. A 2024 request to add Trash to the Categories screen (Trac ticket 61863) was closed as a duplicate of ticket 59804. The core contributor who closed it explained that a Trash for terms needs a status field in the terms tables and a status API like the one posts and comments have, linking to a 2016 proposal for exactly that, which has not been built. You can read the ticket discussion in the wp-trac archive.
So the real question is not how to undelete, but what you can rebuild, and that depends on what the deletion destroyed.
What exactly happens when you delete a category?
We read wp_delete_term() in WordPress 7.1.4 and then watched it run on a test site with a parent category, a child category, three posts, a menu link and one piece of term meta. This is what disappears and what survives:
Item | What WordPress does | Can you get it back? |
|---|---|---|
The category row (name, slug, description) | Deleted from the terms and term_taxonomy tables | Backup, or retype it |
Posts in the category | Kept. A post whose only category was this one is moved to the default category (usually Uncategorized). A post in other categories just loses this one | Yes, by reassigning |
Child categories | Kept, but moved up to the deleted category’s parent (top level if it had none) | Yes, set the parent again |
Term meta (colours, images, SEO fields stored as term meta) | Deleted | Backup only |
Menu items linking to the category | Deleted from every menu | Re-add them |
The category archive URL | Starts returning 404 | Yes, recreate with the same slug |
The term ID | Gone for good | Not with core tools; a new category gets a new ID |
Two details matter later. First, the default category itself cannot be deleted; core refuses and returns without doing anything. Second, WordPress does not record which posts it moved to the default category. After the deletion, a post that was always in Uncategorized looks exactly like one that was just moved there.
The screen under Posts, then Categories, says as much in its own help text: deleting a category does not delete its posts, and posts that were only in the deleted category are set to the default category.
Do post revisions bring back a deleted category?
No. Revisions only store a post’s title, content and excerpt. In core, the list of revisioned fields comes from _wp_post_revision_fields(), and those three are the only defaults. Categories and tags live in a separate relationships table that revisions never touch, so restoring an older revision of a post will not put it back in a deleted category. Our guide to limiting and cleaning up post revisions explains what revisions do store and how much space they use.
Is the category really deleted, or just hidden?
Before you restore anything, rule out the cases where nothing was deleted at all. These take two minutes:
- Search the Categories screen. On sites with hundreds of categories, the one you want may be on page 4. Use the search box, or raise the number per page under Screen Options.
- Check your role. Only users with the
manage_categoriescapability (Administrators and Editors by default) see the Categories screen. If a role plugin changed that, the menu simply disappears. - Check the right taxonomy. WooCommerce product categories live under Products, not Posts. A category from a custom post type has its own screen under that post type.
- Ask WP-CLI. It lists every term in the database, whatever the admin screens show.
# Checked on 18 Nov 2026 with WP-CLI 2.12.0.
# Every category, with its ID, slug, parent and post count.
wp term list category --fields=term_id,name,slug,parent,count
# Look for one slug directly.
wp term get category recipes --by=slugIf wp term get answers “Term doesn’t exist”, the category is gone and it is time to restore.
How do I restore a deleted category from a backup?
You have two routes, and the choice depends on how much has changed since the backup was taken.
Route 1: restore the whole database
If the deletion happened minutes ago and nobody has published, commented or taken an order since, restoring the full database backup from just before the deletion is the fastest fix. It brings back the category, its ID, its term meta, its menu links and every post assignment exactly as they were.
The catch is that a full restore rolls back everything else too. Any post, comment, form entry, user or WooCommerce order created after the backup is lost. Always take a fresh backup of the current site before restoring an older one, so you can undo the restore if it goes wrong.
Route 2: copy just the category back out of the backup
On a busy site, restore the backup somewhere else and copy only the category data across. You need the backup’s database file (usually a .sql or .sql.gz inside your backup plugin’s archive or your host’s backup download) and command-line access to MySQL or MariaDB. Load it into a temporary database first:
# Checked on 18 Nov 2026. Use a separate database: never import over the live one.
mysql -u dbuser -p -e "CREATE DATABASE restore_tmp"
mysql -u dbuser -p restore_tmp < backup.sqlThen read the category, its posts, its child categories and its term meta from the temporary copy. Replace wp_ with your table prefix and recipes with the lost slug. The default tables these queries use are explained in our post on how many tables a default WordPress install has.
-- Checked on 18 Nov 2026. Run against restore_tmp, not the live database.
-- 1. The category itself: note the old term_id, name, description and parent.
SELECT t.term_id, t.name, t.slug, tt.description, tt.parent
FROM wp_terms t
JOIN wp_term_taxonomy tt ON tt.term_id = t.term_id
WHERE tt.taxonomy = 'category' AND t.slug = 'recipes';
-- 2. Every post that was in it.
SELECT tr.object_id
FROM wp_term_relationships tr
JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
JOIN wp_terms t ON t.term_id = tt.term_id
WHERE tt.taxonomy = 'category' AND t.slug = 'recipes';
-- 3. Its child categories (use the old term_id from query 1).
SELECT t.slug
FROM wp_terms t
JOIN wp_term_taxonomy tt ON tt.term_id = t.term_id
WHERE tt.taxonomy = 'category' AND tt.parent = 2;
-- 4. Its term meta (colours, images, SEO fields).
SELECT meta_key, meta_value FROM wp_termmeta WHERE term_id = 2;
-- 5. Posts that were NOT in the default category before the deletion.
-- WordPress moved these to Uncategorized; you will remove it from them.
-- 1 is the usual ID of Uncategorized: check Settings, then Writing.
SELECT tr.object_id
FROM wp_term_relationships tr
JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
JOIN wp_terms t ON t.term_id = tt.term_id
WHERE tt.taxonomy = 'category' AND t.slug = 'recipes'
AND tr.object_id NOT IN (
SELECT tr2.object_id
FROM wp_term_relationships tr2
JOIN wp_term_taxonomy tt2 ON tt2.term_taxonomy_id = tr2.term_taxonomy_id
WHERE tt2.taxonomy = 'category' AND tt2.term_id = 1
);Query 5 solves the problem we mentioned earlier: WordPress keeps no record of which posts it moved, but the backup does. Save the results of all five queries before moving on.
How do I restore a category with WP-CLI?
With the backup data in hand, rebuild the category on the live site. We ran this exact sequence on our test site after deleting a “Recipes” category with one child, three posts, a menu link and a colour stored in term meta; every item came back.
# Checked on 18 Nov 2026 with WP-CLI 2.12.0 on WordPress 7.1.4.
# Values come from the backup queries above.
# 1. Recreate the category with the SAME slug, so its archive URL works again.
NEW_ID=$(wp term create category "Recipes" --slug=recipes --description="Kitchen notes" --porcelain)
# 2. Put each child category back underneath it.
wp term update category soups --by=slug --parent="$NEW_ID"
# 3. Reassign every post from query 2.
for id in 5 6 7; do wp post term add "$id" category recipes; done
# 4. Remove Uncategorized only from the posts listed by query 5.
for id in 5 6; do wp post term remove "$id" category uncategorized; done
# 5. Restore term meta from query 4.
wp term meta add "$NEW_ID" color red
# 6. Re-add the menu link (use your menu's slug or ID).
wp menu item add-term main-menu category "$NEW_ID"
# Check the result.
wp term list category --fields=term_id,name,slug,parent,countThen drop the temporary database with mysql -u dbuser -p -e "DROP DATABASE restore_tmp". If you have many posts, paste the IDs from query 2 into the loop, or pipe them in from a file; wp post term add handles one post per call.
One limitation remains: the new category has a new term ID. Anything that pointed at the old ID needs updating, which we cover two sections down.
How do I get a category back without a backup?
You can still rebuild it; the hard part is working out which posts belonged to it. Recreate the category first, under Posts, then Categories, with exactly the same name and slug, and the same parent if it had one. Then find its posts with whatever evidence you have:
- The posts now in Uncategorized. If you rarely leave posts uncategorized, nearly everything there came from the deleted category. Filter the Posts list by Uncategorized to see them.
- The old archive page in a web archive. If the category was public for a while, the Internet Archive may have captured
/category/your-slug/, which lists the posts that were in it. - Your own records. Search Console’s page reports, analytics landing pages, and your XML sitemap from before the deletion can all show which URLs sat under that category.
- Post slugs and content. On a single-topic category, searching the Posts screen for a keyword often finds the rest.
Then reassign them in bulk. On the Posts screen, tick the posts, choose Edit from Bulk actions, tick the recreated category and click Update. In current WordPress, the Bulk Edit category box shows Uncategorized as ticked when every selected post has it; unticking it there removes it from all the selected posts in the same step. Our guide on accessing WordPress archive pages shows how to confirm the category archive lists the right posts afterwards.
Will my category URL and SEO come back?
The URL comes back; some settings do not. Because WordPress builds category links from the slug (/category/recipes/ by default), recreating the category with the same slug makes the old archive URL return a 200 again, and links from other sites start working. Do this quickly: the longer the URL returns 404, the more likely search engines drop it.
Anything keyed to the old term ID is a different story:
- Old
?cat=2style links point at an ID that no longer exists. - Query Loop blocks, widgets and shortcodes that filter by category store IDs, so edit them and pick the category again.
- Plugins that save category IDs in their settings, such as related-post or showcase plugins, need the category re-selected.
- Category titles and descriptions set in an SEO plugin were stored in term meta or the plugin’s own option, so restore them from the backup query or retype them.
If you decide not to bring a category back, redirect its archive URL to the closest live category or page with a 301, so visitors and search engines land somewhere useful instead of a 404.
Does the same apply to tags, product categories and custom taxonomies?
Yes. Every taxonomy goes through the same wp_delete_term() function, so none of them has a Trash. The one difference is the default term: categories have a default category, so posts are never left without one. Tags have no default, so posts simply lose the tag and nothing marks them. A custom taxonomy only gets a default if the plugin that registers it sets one. WooCommerce product categories have no Trash either: the products stay, and WooCommerce runs a background job that puts any product left with no category into its own default product category, usually Uncategorized. The backup queries above work for any of them; change 'category' to the taxonomy name, such as post_tag or product_cat.
How do I stop this happening again?
A deleted category is a small disaster, but it is a good test of your safety net. These are the steps we take on client sites:
- Keep database backups you can open. Daily is the minimum on an active site, hourly or real-time on a shop. Download one now and check you can find the
.sqlfile inside, because Route 2 needs it. - Limit who can delete categories. Deleting a category requires
manage_categories, which Administrators and Editors have. If your editors only write, a role editor plugin can remove it from them. - Log deletions as they happen. An activity log plugin records who deleted what. Or drop the small must-use plugin below into
wp-content/mu-plugins/: it writes each deleted term, and the IDs of the posts it held, to your PHP error log. - Be careful with “restore” plugins. A term Trash plugin only helps if it was installed before the deletion. See the notes in the next section about the two we checked.
<?php
/**
* Plugin Name: Log deleted terms
* Description: Writes every deleted term and the IDs of the posts it held to the PHP error log.
*
* Checked on 18 Nov 2026 with WordPress 7.1.4 and PHP 8.3.
* Uses the delete_term action, which passes a copy of the deleted term
* and the object IDs it was attached to (available since WordPress 4.5).
*/
add_action(
'delete_term',
function ( $term_id, $tt_id, $taxonomy, $deleted_term, $object_ids ) {
if ( ! $deleted_term instanceof WP_Term ) {
return;
}
error_log(
'Deleted term: ' . wp_json_encode(
array(
'taxonomy' => $taxonomy,
'term_id' => $term_id,
'name' => $deleted_term->name,
'slug' => $deleted_term->slug,
'description' => $deleted_term->description,
'parent' => $deleted_term->parent,
'object_ids' => array_map( 'intval', (array) $object_ids ),
'user_id' => get_current_user_id(),
)
)
);
},
10,
5
);When we deleted our test category with this file in place, the log showed the name, slug, description, parent and all three post IDs, which is everything the WP-CLI restore needs, with no backup at all. Make sure your host writes the PHP error log somewhere you can read it. Our list of WordPress database mistakes covers more ways to keep this kind of data loss from happening.
Should I use a plugin to restore deleted categories?
Only one that was installed before the deletion can help, because no plugin can recover data WordPress has already removed. We checked the two options in the WordPress.org directory on 18 November 2026:
Plugin | Status on 18 Nov 2026 | Our view |
|---|---|---|
TP Restore Categories And Taxonomies | Closed on WordPress.org since 15 April 2026 for a security issue; not downloadable | Remove it if you still run it (see the advisory below) |
Axle Category & Tag Trash | Version 3.0.0, added 9 November 2026, tested up to 7.1.4, no installs or reviews yet | Promising feature set, but too new to judge; test it on staging first |
The TP Restore plugin is the subject of CVE-2026-4128, published on 22 April 2026 with Wordfence as the assigner. It affects all versions up to and including 1.0.1: a missing capability check lets any logged-in user, including Subscribers, permanently delete terms from the plugin’s own backup tables. It is rated 4.3 (Medium). No fixed version was published before the plugin was closed.
The Axle Category & Tag Trash listing says it keeps deleted terms for 30 days by default and restores them with the same ID, term meta, posts, child terms and menu links, and that it removes Uncategorized from posts that only got it from the deletion. Those are exactly the gaps core leaves, but with no install base or reviews yet we cannot vouch for it, so treat it as something to evaluate rather than rely on.
Common mistakes people report
These are recurring problems from support forums, the WordPress bug tracker and vulnerability databases. We paraphrase each one and link the source. Checked on 18 November 2026.
- 174 posts dumped into the default category. A site owner deleted a category by accident and every one of its 174 posts moved to the default category, which in their case was named after them. Recreating the category and bulk-adding it was easy; removing the default category from all those posts was not possible in bulk at the time. Current WordPress lets you untick it in Bulk Edit. (WordPress.org forum, 2011)
- A plugin stopped finding categories after they were recreated. A store deleted and re-added its product categories, and a category showcase plugin no longer recognised some of them. The developer explained that recreated categories get new IDs, and the plugin still pointed at the old ones. (WordPress.org forum, July 2024)
- Restoring the whole database to fix a few categories. When a user asked how to repair damaged categories, a forum moderator suggested restoring the database from before the damage, and warned that anything changed after that backup would be lost. That trade-off is why we prefer copying only the category back. (WordPress.org forum, March 2020)
- Expecting a Trash tab for categories. A user asked for All, Draft and Trash views on the Categories screen so deleted categories could be recovered. The ticket was closed as a duplicate, because terms have no status field to support a Trash. (WordPress Trac ticket 61863, August 2024)
- Relying on a restore plugin that was itself vulnerable. Sites that installed a category restore plugin as a safety net were left with a closed plugin and a published advisory, CVE-2026-4128, for its delete action. (CVE.org, April 2026)
Frequently asked questions
Where do deleted categories go in WordPress?
Nowhere. Unlike posts, deleted categories are removed from the database immediately. Only a backup or a log still holds them.
Does deleting a category delete its posts?
No. Posts stay published. Posts that had only that category move to the default category; posts with other categories keep those.
Can I give a recreated category its old ID?
Not with the admin screens or WP-CLI, which always assign the next free ID. A full database restore keeps the old ID. Editing IDs directly in SQL is possible but risky, so we only recommend it if many hard-coded references depend on that ID and you have a tested backup.
Why can’t I delete the Uncategorized category?
Because it is the default category, and WordPress refuses to delete the default. Choose another default under Settings, then Writing, and Uncategorized becomes deletable.
I deleted a parent category. Where did the subcategories go?
They are still there, moved up one level to the deleted category’s parent, or to the top level. Recreate the parent and set it as their parent again.
Will Google penalise my site for a deleted category?
There is no penalty, but the archive URL returns 404 and can drop out of results. Recreate it with the same slug or 301 it to a relevant page.
Plugins we build and run
We maintain these ourselves, which is why we can support them on your site.
- BuddyNextThe self-hosted community engine for WordPress
- BuddyXFree community theme, Pro when you outgrow it
- ReignPremium community theme. Add pieces, build anything
- JetonomyCommunity forum and Q&A for WordPress
- EventonomyEvents and RSVPs for WordPress communities
- LearnomyCourses and learning communities on WordPress
- ListoraDirectories and listings your members can browse
- SnipShareCode sharing built for developer communities
- WB Ad ManagerAd placements that turn traffic into revenue
- WP Career BoardA job board your community actually uses
- WP Sell ServicesSell services with offers, orders, and payouts
- MediaVersePhotos, video, and media albums for members
- WB GamificationPoints, badges, and rewards that keep members active
- Product RoadmapPublic roadmaps with voting your users trust


