Created
July 21, 2015 00:34
-
-
Save pippinsplugins/a0a938ddb4fbb8b8747d to your computer and use it in GitHub Desktop.
Bulk set EDD Commissions to "unpaid" for all commissions after a specific date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$commissions = get_posts( array( | |
'post_type' => 'edd_commission', | |
'posts_per_page' => -1, | |
'fields' => 'ids', | |
'date_query' => array( | |
'after' => array( | |
'year' => 2015, | |
'month' => 03, | |
'day' => 15 | |
), | |
), | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'edd_commission_status', | |
'terms' => 'paid', | |
'field' => 'slug' | |
) | |
) | |
) ); | |
if( $commissions ) { | |
foreach( $commissions as $c ) { | |
eddc_set_commission_status( $c, 'unpaid' ); | |
} | |
} | |
echo 'done'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use this snippet?