Title: Automatic Page Creation
Last modified: August 20, 2016

---

# Automatic Page Creation

 *  [nickkos](https://wordpress.org/support/users/nickkos/)
 * (@nickkos)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/automatic-page-creation/)
 * I know of themes that automatically create pages when they are installed. And
   the same with plugins…I’d like to know how i can do this for the theme I am creating.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Rebecca O'Brien](https://wordpress.org/support/users/rjmastey/)
 * (@rjmastey)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/automatic-page-creation/#post-3299733)
 * You’ll want to use [wp_insert_post](http://codex.wordpress.org/Function_Reference/wp_insert_post).
   That will let you generate any post/page you’d like, and will return the ID so
   you can update other options (like static front page, for example).
 *  [parbat patel](https://wordpress.org/support/users/smoothcoding/)
 * (@smoothcoding)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/automatic-page-creation/#post-3299787)
 * you can create in this way
 * // Create post object
    $my_post = array( ‘post_title’ => ‘your post title’, ‘
   post_content’ => ‘Your Post content or shortcode.’, ‘post_status’ => ‘publish’,‘
   post_author’ => 1, ‘post_category’ => array(8,39) );
 * // Insert the post into the database
    wp_insert_post( $my_post );

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Automatic Page Creation’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 3 participants
 * Last reply from: [parbat patel](https://wordpress.org/support/users/smoothcoding/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/automatic-page-creation/#post-3299787)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
