Delete all posts from a specific catergory (sql code)
-
Hello guys, as i am not very familiar with SQL code etc i am looking for a the SQL-code to delete all post from a category. At the moment i am using:
DELETE a,b,c,d
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id =<category id>If i fill in the catID it deletes all posts in the category but also the catergory itself. Anyone can adjust the SQL so it only deletes the posts out of that category.
Thank you very much in advance
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Delete all posts from a specific catergory (sql code)’ is closed to new replies.