MySQL Find/Delete WordPress Post Type

Sometimes you just need to dump all the data from a post type and start over. Sometimes you need to do a little housekeeping on the db for data you no longer need/use.

 

MySQL query

Use with caution. Always backup your database first. Replace ‘product’ with your post type name.


SELECT * FROM `wp_posts` WHERE `post_type` LIKE 'product' ORDER BY `post_type` ASC
DELETE FROM `wp_posts` WHERE `post_type` LIKE 'product'

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *