wordpress MYSQL query to select/delete posts based on date and category

Following is sample mysql query to use against wordpress database to select or delete posts based on date from particular category of posts
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 =1 and a.post_date < '2011-08-01'
Sign In or Register to comment.