Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. $args = array(
  2. 'date_query' => array(
  3. array(
  4. 'column' => 'post_date_gmt',
  5. 'before' => '1 year ago',
  6. )
  7. ),
  8. 'posts_per_page' => -1,
  9. );
  10. $query = new WP_Query( $args );
  11.  
  12.  
  13. $the_query = new WP_Query( $args );
  14.  
  15. if ( $the_query->have_posts() ) :
  16. while ( $the_query->have_posts() ) : $the_query->the_post();
  17.  
  18. wp_delete_post( the_ID() );
  19.  
  20. endwhile;
  21. endif;
  22.  
  23. wp_reset_postdata();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement