Bulk set EDD Commissions to "unpaid" for all commissions after a specific date
<?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
This comment has been minimized.
How to use this snippet?