Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Delete all post of custom post type 'memberlist' and... WordPress


I need to Delete all posts of custom post type 'memberlist' and any data such as post-meta, or any other data related to that custom-post-id.

Would like SQL statement to execute from phpmyadmin.

Answers (2)


Rashid Aliyev answers:

DELETE * from wp_posts where post_type = "memberlist";


John Cotton answers:

DELETE FROM wp_posts WHERE post_type = 'memberlist';

DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT id FROM wp_posts);

You could - for good measure - remove all tags/category associations in any exist:

DELETE FROM wp_term_relationships WHERE object_id NOT IN (SELECT id FROM wp_posts);

PS Backup first!!!