Title: wp_insert_post() doesn&#039;t works
Last modified: August 21, 2016

---

# wp_insert_post() doesn't works

 *  [evgenyan](https://wordpress.org/support/users/evgenyan/)
 * (@evgenyan)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/wp_insert_post-doesnt-works/)
 * Hi!
    This is my code:
 *     ```
       $my_post = array(
       		'post_title'    => 'My post',
       		'post_content'  => 'This is my post.',
       		'post_category' => array(1),
       		'post_status'   => 'publish',
       		'post_author'   => 1,
       		'post_date' 	=> date('Y-m-d H:i:s'),
       		'post_date_gmt' => date('Y-m-d H:i:s')
       );
   
       // Insert the post into the database
       wp_insert_post( $my_post );
       ```
   
 * Why it isn’t works? What’s a problem?

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/wp_insert_post-doesnt-works/#post-4048463)
 * This seems to work for me. Perhaps a plugin or something in your theme is interfering.

Viewing 1 replies (of 1 total)

The topic ‘wp_insert_post() doesn't works’ is closed to new replies.

## Tags

 * [Creation](https://wordpress.org/support/topic-tag/creation/)
 * [insert post](https://wordpress.org/support/topic-tag/insert-post/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [wp_insert_post](https://wordpress.org/support/topic-tag/wp_insert_post/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/wp_insert_post-doesnt-works/#post-4048463)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
