3

I just migrated to worpress and want to remove all of the 'uncategorized' categories, since all of my posts are now all categorized. Is there a way to do this easily?

1

Yes and no. The main 'uncategorized' category is the main one built into the core, and shouldn't be removed. You can rename it to something else. If they are still attached to the posts, then you could delete it from the database tables directly.

2
  • I always asked myself why that is... . – hakre Aug 27 '10 at 22:47
  • 1
    It's so that permalink structures with %category% in them will always work. – scribu Feb 18 '11 at 13:49
1

Choose a different category as your default category under Settings > Writing. Then you will be able to delete the category "uncategorised".

2
  • First of all, that function has been around since WP 2.0. Most importantly, it won't allow you to delete the default category, which is what the OP is trying to do. – scribu Feb 18 '11 at 13:47
  • edited my answer above - deleting the default 'uncategorised' category is possible by doing this. also, deleting a category will remove it from all posts across the site. no direct db editing required :-) – Innate Feb 23 '11 at 8:35
1

Yes, you can. By following what @Innate said, I created a new category called "General". All the bulk posts I created earlier (from BulkPress plugin) had "Uncategorized" and "my-own-category" (added by Bulk edit). Then, I chose "General" as my default category under Settings > Writing. Next, I deleted the category "Uncategorized". "Uncategorized" was removed from all the posts, leaving "my-own-category" as the only category. Plus, all new posts that I don't create a category for will be marked as "General", which I like more than "Uncategorized".

1
  • This is the correct answer. You can delete any category, as long as it is not being used by any post. By changing all posts to 'my-own-category', you removed any usage of the 'uncategorized' category, so it can be deleted. Then set the desired category as the default (in Settings, Writing). – Rick Hellewell Jul 4 '17 at 2:04
0

As far as I know this is not possible via the GUI. That could be done by a little script that queries all posts that have more than one category and the "uncategorized" category and then removing the "uncategorized" category. I'm working on it.

3
  • Still working on it, the Taxnomy API is somehow inflexible when you want to remove something - e.g. a single category - and it does not make fun to work with it. – hakre Aug 25 '10 at 9:15
  • You don't have to work on this for me. My blog isn't that big, so I just went through and manually updated the categories. – Mark Aug 26 '10 at 13:45
  • well in the end I was curious on how to remove cats. but well, did not get far. there was different stuff for the day. – hakre Aug 27 '10 at 1:40
0

Crazy old post but in case you get here through Google, here is what worked for me using WP CLI

wp post list --fields=ID --format=csv | while read line ; do wp post term remove $line category uncategorized ; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy