WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
can you tell me what is term_id & term_taxonomy of uncategorized ? is it 1? – Vinod Dalvi Feb 28 '13 at 6:53
term_id of uncategorized is 1. haven't check term_taxonomy yet – Tuan Anh Tran Feb 28 '13 at 8:07
term_taxonomy_id is required to execute following query. – Vinod Dalvi Feb 28 '13 at 8:36
I'll give it a try on localhost. Thank you Vinod. – Tuan Anh Tran 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
share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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