Created
May 4, 2012 01:46
-
-
Save MrAlexWeber/2591192 to your computer and use it in GitHub Desktop.
sql to remove posts from a category given a post author and category id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete b | |
from wp_posts a | |
left join wp_term_relationships b ON ( a.ID = b.object_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 = YOUR_TERM_ID and a.post_author = YOUR_AUTHOR_ID; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
please don't blame me if this breaks anything! it worked for me, but you should definitely test it with
select *
andlimit 50
before you run it withdelete
.