So I have a bunch of posts assigned categories like: a main one and uncategorized one (which I forgot to unselect).

The problem is that i'm using %category%/%postname% as permalink which will use the lower ID category in permalink, which obviously will be uncategorized.

How do I unassign uncategorized category from those posts (2000+ posts). I guess I probably need to write a query for this. Has anyone done this before?

Or should I just update the ID of uncategorized to a very high number?

  • can you tell me what is term_id & term_taxonomy of uncategorized ? is it 1? Feb 28 '13 at 6:53
  • term_id of uncategorized is 1. haven't check term_taxonomy yet Feb 28 '13 at 8:07
  • term_taxonomy_id is required to execute following query. Feb 28 '13 at 8:36
  • I'll give it a try on localhost. Thank you Vinod. Feb 28 '13 at 8:37

You can fire following query on your wordpress database to unassign uncategorized category from all posts.

DELETE FROM wp_term_relationships WHERE term_taxonomy_id = term_taxonomy_id of  uncategorized category

I suggest you use a plugin called Batch-Move by http://www.walchum.net/

It lets you query for posts, then select the posts you want removed from any category, and removes them from the category in a batch process.

Your Answer

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

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