• Hello, i look reference from the net and found 2 method on how to delete all the post in custom post type:

    1. with SQL : DELETE FROM WP_POST WHERE post_type=’mycustomposttype’
    2. through loop and delete manually: wp_delete_post( $loop->post->ID, true);

    I really like the first approach since its tons way faster for large post… but is there any negative impact if i delete directly from the WP_POST ?

    Thanks

Viewing 1 replies (of 1 total)
  • The SQL delete will not remove any associated entries in other tables such as wp_postmeta and wp_term_relationships.

    As an alternative if you don’t have too many posts, go to the listing of all the custom posts, click ‘Screen Options’, and set the number next to the post type name to a high number (like 300). Then select all posts and use the Bulk Actions to move them to the trash.

Viewing 1 replies (of 1 total)
  • The topic ‘Delete post in custom post type. Which one is better?’ is closed to new replies.