I would like to give my user the ability to publish a post and the post only becomes visible (like with a published status) when the date hits. I'm using the following code to try and set it to published but on a future date:
$bmt_post = array( 'post_title' => wp_strip_all_tags( $title ), 'post_content' => $information, 'post_status' => 'publish', 'post_category' => array( $cat_ids ), 'post_date_gmt' => $postdate, 'post_date' => $postdate, ); $post_id = wp_insert_post( $bmt_post );
When I do this, the post is already visible even though it's scheduled for a future date. If I remove the
'post_status' => 'publish' then it creates the post as a draft but then someone would have to go back on the date and change the status from draft to published.
How can I do this so when the user creates the post it's created for the future and only becomes visible when the post_date is the actual date? I know there is a
'post_status' => 'future' but does that automatically convert to published on that date?