Is it possible to delete a huge number of wordpress posts through SQL query using phpmyadmin by using a permalink list of posts that I want to delete ?
2 Answers
Yes you can. To delete posts with inherit post meta, use following code:
DELETE
p,pm
FROM wp_posts p
JOIN wp_postmeta pm ON pm.post_id = p.id
WHERE p.post_name IN ('post-1', 'post-2', 'post-3')
Pass slugs array to WHERE clause.
If you want to delete only posts w/out postmeta (for some reason), use this code:
DELETE
FROM wp_posts
WHERE post_name IN ('post-1', 'post-2', 'post-3')
It depends on permalinks. Permalinks can contain more then just the post name (slug). Also, post names don't have to be unique. So, it is possible, but it depends on many other factors.