Was wondering if you had the
class childtheme_coupon_core class in your _functions.php or any other class in there? If so, then it may be better to put the above function within the class itself and call the ‘add_action’ from within the ‘__construct’ section.
Here’s some code you can add (in conjunction with the above code) if you wanted to change the expiration meta query:
$curr_meta_query = array( 'expirydate' => array( 'key' => 'expiry_date', 'value' => date('Y-m-d H:i:s', time()), 'compare' => '<=', 'type' => 'DATETIME' )); $wp_obj->set( 'meta_query', $curr_meta_query);
This example would look for all the coupons that have expired prior to that moment.
Note: The setting PremiumPress > Configuration > Coupon Settings > SHOW EXPIRED COUPONS would need to be turned on.
Copyright © 2010-2020 PremiumPress Limited.