WordPress Delete Categories and Posts Within Using SQL
| If you're new here, you may want to subscribe to the RSS feed to receive future posts quickly.It's completely free! Thanks for visiting! | |
Have you ever wanted to delete some categories and posts within it from your WordPress blog? Here is one simple step to delete multiple categories and the posts associated with it in a single step using a little SQL. If you have a PhpMyAdmin interface to your MySql , it would be better and simple.
Before even trying for this step , take a backup of your wordpress Database.Playing with SQL may cause corruption. A detailed step by step instruction is available here . For those who dont know, steps to take PhpMyAdmin is explained there , which will be needed in following steps.
Follow the 3 steps to delete unwanted categories and posts from your wordpress blog through SQL.
You can easily get the Category-Id from
Manage>Categories
and then click the link for the category you want to delete.Now , check the addressbar , which will look like the following image. The category id will be mentioned there as cat_ID=X where X is the desired category id. In this image, the category id is ’5′.
![]()
Also take a note on number of posts in this particular category,which will be listed in Manage>Category page.This is just for double checking the category before deleting from MySql.
-
Step 2 : Open the Sql Interface.
I am explaining with PhpMyAdmin, which will be the most common interface to MySql.
Open the database for your blog from PhpMyAdmin.(By default it will be wrdp1).
Open the table : ‘wp_term_taxonomy’ . And browse that table.Sort the records with respect to ‘taxonomy‘ column , by which you can easily seperate Post Categories,Link Categories and Post Tags from the records.
You can also use the SQL query :
SELECT *
FROM `wp_term_taxonomy`
ORDER BY `wp_term_taxonomy`.`taxonomy` ASC
LIMIT 0 , 30
The column ‘term_id’ is what that lists the Category Id which we found out in Step 1. In our example we had the Category Id : 5. So we have to look for a record whose ,
term_id=<category ID> and taxonomy = ‘category’ .
Double check it by the total number of posts which will be listed under the column count.
-
Step 3
elete it!
If everything is perfect , click the delete button for that particular row, which in case of PhpMyAdmin is denoted by a small X on the left side of each row.
Thats it! The particular category and all the posts linked with it will be gone by now. You can check it through your blog or in the Admin Panel.
PS: FLuiDs.in has no responsibility if your blog went kaput!
But you can drop a comment here if you have any doubts or having trouble with steps.


The best thing to do is use the WP interface itself to delete it.
If you want to use the phpMyAdmin to delete the stuff, make sure you take a backup first.
This one is for a few unlucky ones like me
whose wp interface is acting wierd after updating to 2.6 . Issues with bulk deletion of posts and deletion of categories.
Srijiths last blog post..WordPress Delete Categories and Posts Within Using SQL
Thanx a Bundle
dunnow whym but my wordpress was not deleting the categories.. this really helped a LoT
Binny, I hope you can come up with a solution for this problem