Programmatically setting draft date not working
-
I’m using version 3.3.0 of PublishPress Future. I’m trying to programmatically set a post to draft when a post is created or updated, but no matter what date is set it seems to default to 7 days after the post published date. Do you know what I’m doing wrong?
function update_post_expiration($post_id, $post_after, $post_before) { $application_deadline = get_post_meta( $post_id, 'application_deadline', true ); $timestamp = strtotime( str_replace('-', '',$application_deadline) ); $timestamp = strtotime('+1 day',$timestamp); $timestamp--; if (defined('PUBLISHPRESS_FUTURE_LOADED')) { do_action('publishpressfuture_unschedule_expiration', $post_id); $options = [ 'expireType' => 'draft', 'id' => $post_id, ]; do_action( 'publishpressfuture_schedule_expiration', $post_id, $timestamp, $options ); } } add_action('post_updated', 'update_post_expiration', 10, 3);
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Programmatically setting draft date not working’ is closed to new replies.