Empty WordPress custom post Data from MySql database table

Sometime while working on huge WordPress site, we may need to remove the old custom post data. Today we will discuss on how we can perform this action. For this we need to have phpmyadmin access,

then in SQL run the below code one by one as shown in figure above,

DELETE FROM wp_posts WHERE post_type='post_type';
DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT id FROM wp_posts);
DELETE FROM wp_term_relationships WHERE object_id NOT IN (SELECT id FROM wp_posts);

The first line deletes all posts with that post_type from wp_posts.

The second then removes any post metadata from wp_postmeta that is no longer tied to a post.

The third line removes and tags or categories from wp_term_relationships that were tied to that post type. This line should be omitted if you intend to create more posts of the given post_type in the future.

Source : Stackoverflow