Progammatically set expiration does not work
-
I have followed thesteps on this page:
https://publishpress.com/knowledge-base/technical-details/
in the section entitled “How to schedule expirations programmatically”.
The result is that the Category to expire to does not get checked.
https://ibb.co/GvMkq99My code:
function expire_product($postID, $session_date, $studio_id) { // From the session_date, set the Expiration Date as 45 minutes afterwards. $expiration_date = $session_date->modify('+45 minutes'); $expiration_date->modify('-10 hours'); // Seems to be out by 10 hours $expiration_date_str = $expiration_date->format('Y-m-d H:i:s'); // Get the Product Category ID from the studio id $past_categoryId = intval(get_user_meta($studio_id, 'champ_franchisee_categories_past', true)); if (function_exists('postExpirator_init')) { $options = [ 'expireType' => 'category', 'id' => $postID, 'category' => $past_categoryId, 'categoryTaxonomy' => 'product_cat' ]; $timeStamp = date('U', strtotime($expiration_date_str)); $tempstr=date('d/m/Y H:i:s', $timeStamp); _scheduleExpiratorEvent($postID, $timeStamp, $options); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Progammatically set expiration does not work’ is closed to new replies.