Guest User

Untitled

a guest
Oct 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $args = array(
  5.  
  6. 'post_type' => array( 'product_variation',),
  7.  
  8. // 'post_status' => array( //(string / array) - use post status. Retrieves posts by Post Status, default value i'publish'.
  9. // // 'publish', // - a published post or page.
  10. // // 'pending', // - post is pending review.
  11. // // 'draft', // - a post in draft status.
  12. // // 'auto-draft', // - a newly created post, with no content.
  13. // // 'future', // - a post to publish in the future.
  14. // // 'private', // - not visible to users who are not logged in.
  15. // // 'inherit', // - a revision. see get_children.
  16. // // 'trash' // - post is in trashbin (available with Version 2.9).
  17. // ),
  18. 'posts_per_page' => -1,
  19. );
  20.  
  21. $the_query = new WP_Query( $args );
  22.  
  23. // The Loop
  24. global $post;
  25. if ( $the_query->have_posts() ) :
  26. var_dump($the_query->posts);
  27. while ( $the_query->have_posts() ) : $the_query->the_post();
  28. wp_delete_post($post->ID);
  29. endwhile;
  30. endif;
  31.  
  32. // Reset Post Data
  33. wp_reset_postdata();
Add Comment
Please, Sign In to add comment