Add this to your default theme’s functions.php
function grv_create_default_pages() {
// Create New Default Page
$args = array(
'name' => 'new-default-page',
'post_type' => 'page',
'post_status' => 'publish',
'showposts' => 1,
'caller_get_posts'=> 1
);
$default_page = array(
'name' => 'new default page',
'post_title' => 'NEW DEFAULT POST TITLE',
'post_content' => 'lorem ipsum dolor',
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'page'
);
// Insert the New Page into the database
$new_page_exists = get_posts($args);
if ( empty($new_page_exists) ) {
$new_page = wp_insert_post( $new_page );
// Uncomment if you've a custom template that should be applied to the default page
// update_post_meta($new_page, '_wp_page_template', 'custom-tempate-page.php');
}
// Wanna add some default links? Here you go.
$linkdata = array(
'link_name' => 'Garrick van Buren',
'link_url' => 'http://garrickvanburen.com'
);
$link_id = wp_insert_link( $linkdata );
}
add_action( 'after_setup_theme', 'grv_create_default_pages' );