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 ?


Yes you can. To delete posts with inherit post meta, use following code:

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:

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.