My plugin is on two wordpress sites. The 'main' site sends a post to the child site. The child site receives the post via request to admin-post.php and inserts it as scheduled(future) to be published after some time with new title. Everytime the 'process' works, post is received and inserted, the title is changed BUT... not everytime the post is set as scheduled. Like 30-40% of the cases, the post just gets 'published'. It's weird and I don't know how to track this down and what causes it...?
Here's the sample code for receiving and inserting posts:
$post = array(
'post_title' => $newTitle,
'post_date' => date('Y-m-d H:i:s', strtotime('+30 seconds'),
'post_date_gmt' => gmdate('Y-m-d H:i:s', strtotime('+30 seconds'),
'post_content' => $_POST['post_content'],
'post_status => 'future'
);
wp_insert_post( $post )