Title: Creating Posts Programmtically.
Last modified: August 19, 2016

---

# Creating Posts Programmtically.

 *  [Tanveer](https://wordpress.org/support/users/tanver/)
 * (@tanver)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/creating-posts-programmtically/)
 * Hi friends,
    I am in need of creating posts – basically copying post from one
   blog to other blog, where potentially posts might exist with the same ID – by
   writing a piece of code using PHP. I am planning to usethe function wp_insert_post()
   to insert the posts in the database. Is this the right way to do this? and would
   really appreciate if someone can tell me what tables of the database is it going
   to affect? TIA

Viewing 1 replies (of 1 total)

 *  Thread Starter [Tanveer](https://wordpress.org/support/users/tanver/)
 * (@tanver)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/creating-posts-programmtically/#post-1741714)
 * This is what I am trying to do but unfortunately, the piece of code is not working
   for me
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome).
   Please use the [pastebin](http://wordpress.pastebin.com)]_
 * It gets into the ‘Inserted Post ID: ‘ thing but actually no ID is being assigned
   to the Posts.
    TIA

Viewing 1 replies (of 1 total)

The topic ‘Creating Posts Programmtically.’ is closed to new replies.

## Tags

 * [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
 * 1 participant
 * Last reply from: [Tanveer](https://wordpress.org/support/users/tanver/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/creating-posts-programmtically/#post-1741714)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
