Skip to content

Instantly share code, notes, and snippets.

Created January 13, 2013 20:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4526094 to your computer and use it in GitHub Desktop.
Save anonymous/4526094 to your computer and use it in GitHub Desktop.
<?php
//add_action( 'wp_head', 'tgm_delete_all_orders' );
function tgm_delete_all_orders() {
21
$payments = get_posts( array( 'post_type' => 'edd_payment', 'posts_per_page' => -1, 'post_status' => 'any' ) );
$downloads = get_posts( array( 'post_type' => 'download', 'posts_per_page' => -1 ) );
if ( $downloads ) {
foreach ( $downloads as $download ) {
delete_post_meta( $download->ID, '_edd_download_sales' );
delete_post_meta( $download->ID, '_edd_download_earnings' );
}
}
if ( $payments )
foreach ( $payments as $payment )
wp_delete_post( $payment->ID, true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment