Title: wp_insert_post
Last modified: August 19, 2016

---

# wp_insert_post

 *  [awaisqarni](https://wordpress.org/support/users/awaisqarni/)
 * (@awaisqarni)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/wp_insert_post/)
 * HI All,
    i am using wp_insert_post() in which i am setting post_status=’future’
   but it is not working. it inserts the value publish in database not future. here
   is my code
 *     ```
       $post_insert=array(
       				'post_author'=>$author,
       				'post_date'=>$date,
       				'post_date_gmt'=>$date1,
       				'post_content'=>$content,
       				'post_title'=>$title,
       				'post_excerpt'=>$excerpt,
       				'post_status'=>'future');
       wp_insert_post($post_insert);
       ```
   
 * any one help please

Viewing 1 replies (of 1 total)

 *  [obus3000](https://wordpress.org/support/users/obus3000/)
 * (@obus3000)
 * [15 years ago](https://wordpress.org/support/topic/wp_insert_post/#post-1706877)
 * I was having the same problem and found out something just by reading your post,
   its about the “post_date_gmt” field, you must ensure you are setting that tvalue
   properly since that’s the value that the codex takes to compare and then publish,
   so if its wrong or zero, your post will be published directly.
 * It worked for me.
    cheers

Viewing 1 replies (of 1 total)

The topic ‘wp_insert_post’ is closed to new replies.

## Tags

 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [obus3000](https://wordpress.org/support/users/obus3000/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/wp_insert_post/#post-1706877)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
