Automatic Page Creation (3 posts)

  1. nickkos
    Posted 3 years ago #

    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.

  2. Rebecca O'Brien
    Posted 3 years ago #

    You'll want to use 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).

  3. parbat patel
    Posted 3 years ago #

    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 );

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.