Making posts far into the future using wp_insert_post causing errors
-
I am having issues using wp_insert_post when posting far into the future. If I make a post for the next couple of days it works fine however if I make it to be posted in a month or two it will be posted straight away and isn’t being displayed in the admin area under ‘Posts’
The code I am using is:
//This is what the value of $imageDate looks like.
$imageDate = '2012-10-30';
if($imageDate != false)
{
$imagePost = array(
'post_title' => $imageTitle,
'post_content' => 'Content added later.',
'post_status' => 'future',
'post_date' => $imageDate . " 00:00:00",
'post_author' => 1,
'tags_input' => "'".$imageTags."'",
'post_category' => array(1)
);
}
else
{
$imagePost = array(
'post_title' => $imageTitle,
'post_content' => 'Content added later.',
'post_status' => 'publish',
'post_author' => 1,
'tags_input' => "'".$imageTags."'",
'post_category' => array(1)
);
}$postID = wp_insert_post($imagePost);
- The topic ‘Making posts far into the future using wp_insert_post causing errors’ is closed to new replies.