I have around 2000 posts under a custom post type storelocations. Deleting them from WordPress admin takes a lot of time.

  1. How to delete all the posts from this custom post type from database using mySQL command. Here is my approach:

    DELETE FROM 'wp_posts' WHERE 'post_type' = 'storelocations'

    But I guess the post also have some data in wp_postmeta and some other tables maybe. And I guess I should delete data from there too.

    So, may I know which tables have the data for a post. And what command I should run to clear them.

  2. Another doubt that I have is: why deleting the posts from WordPress admin takes so much time compared to deleting the posts from mySQL. Isn't WordPress doing the same thing as running few SQL commands, or there is much going on?

  • yes, there is much more going on Apr 11, 2017 at 12:07

1 Answer 1


Honestly, the time writing this question and waiting for an answer, is longer than just going into screen options, setting the posts to about 200, and just doing bulk move to trash, and emptying the trash - if you speed is high, you can probably do even more than 200.

else there is a nice tutorial on how and which tables you should work with here - but it will probably take longer


  • Yes. I have done that. But I was wondering for a faster solution with mySQL.
    – Kiran Dash
    Apr 12, 2017 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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