0

i will automatically create a lot of post with the wp_insert_post function

<?php wp_insert_post( $post, $wp_error ); ?> 

all those custom post type will be call "house" and then after some testing, i what all those post and the revision to be deleted, to clear and clean the DB... so how i do that ?

i do all my request with $wpdb what is the query to delete/remove all post_type = house and there revision ?

1 Answer 1

1

Manipulating posts directly in database is rarely good idea, since it skips all the APIs, hooks and so on that normally participate in the process.

You should use get_posts() to retrieve the list and wp_delete_post() for deletion to ensure it is done properly and there are no leftovers.

1
  • i will take good advices from anywhere, because when you think YOUR way to do this is the good way, it's always good to have another point of view.... thanks
    – menardmam
    Commented Dec 21, 2013 at 0:42

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.