Created
March 29, 2016 03:51
-
-
Save jonathonklem/03ca78eb8272f01d7835 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wpmu_new_blog', 'wpb_create_my_pages', 10, 2); | |
function wpb_create_my_pages($blog_id, $user_id){ | |
switch_to_blog($blog_id); | |
// create new page | |
$page_id = wp_insert_post(array( | |
'post_title' => 'Home', | |
'post_name' => 'home', | |
'post_content' => 'Welcome to our shop.', | |
'post_status' => 'publish', | |
'post_author' => $user_id, // or "1" (super-admin?) | |
'post_type' => 'page', | |
'menu_order' => 1, | |
'comment_status' => 'closed', | |
'ping_status' => 'closed', | |
)); | |
update_option( 'page_on_front', $page_id ); | |
update_option( 'show_on_front', 'page' ); | |
// Find and delete the WP default 'Sample Page' | |
$defaultPage = get_page_by_title( 'Sample Page' ); | |
wp_delete_post( $defaultPage->ID ); | |
wp_insert_post(array( | |
'post_title' => 'About Us', | |
'post_name' => 'about-us', | |
'post_content' => 'Add information about your group here.', | |
'post_status' => 'publish', | |
'post_author' => $user_id, // or "1" (super-admin?) | |
'post_type' => 'page', | |
'menu_order' => 1, | |
'comment_status' => 'closed', | |
'ping_status' => 'closed', | |
)); | |
wp_insert_post(array( | |
'post_title' => 'Contact Us', | |
'post_name' => 'contact-us', | |
'post_content' => 'Add information about contacting you here.', | |
'post_status' => 'publish', | |
'post_author' => $user_id, // or "1" (super-admin?) | |
'post_type' => 'page', | |
'menu_order' => 1, | |
'comment_status' => 'closed', | |
'ping_status' => 'closed', | |
)); | |
restore_current_blog(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment