Created
June 29, 2017 14:28
-
-
Save SeanTOSCD/b77f3c3ad36e3e80411008461c27596a to your computer and use it in GitHub Desktop.
EDD SL get expired licenses
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 | |
// check for expired licenses | |
$license_args = array( | |
'posts_per_page' => -1, | |
'post_type' => 'edd_license', | |
'post_status' => 'any', | |
'meta_query' => array( | |
'relation' => 'AND', | |
array( | |
'key' => '_edd_sl_user_id', | |
'value' => get_current_user_id(), | |
'compare' => '=' | |
), | |
array( | |
'relation' => 'AND', | |
array( | |
'key' => '_edd_sl_status', | |
'value' => 'expired', | |
'compare' => '=' | |
), | |
array( | |
'key' => '_edd_sl_expiration', | |
'value' => time(), | |
'compare' => '<' | |
) | |
), | |
), | |
); | |
$license_keys = get_posts( $license_args ); | |
// how many expired licenses are there? | |
$expired_qty = count( $license_keys ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment