Multisite

Standard-Seite in Multisite ändern/hinzufügen

Verwendet in: Meine letzte Seite
Anleitung:

Folgenden php-Code in die Functions.php einfügen

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' => 'About',
'post_name' => 'about',
'post_content' => 'This is an about page. Feel free to edit or delete this page.',
'post_status' => 'publish',
'post_author' => $user_id, // or "1" (super-admin?)
'post_type' => 'page',
'menu_order' => 1,
'comment_status' => 'closed',
'ping_status' => 'closed',
));

// Find and delete the WP default 'Sample Page'
$defaultPage = get_page_by_title( 'Beispiel-Seite' );
wp_delete_post( $defaultPage->ID );

restore_current_blog();
}
// Find and delete the WP default 'Hello world!' post
$defaultPost = get_posts( array( 'title' => 'Hallo Welt!' ) );
wp_delete_post( $defaultPost[0]->ID, $bypass_trash = true );

restore_current_blog();
$about = get_page_by_title( 'About' );
update_option( 'page_on_front', $about->ID );
update_option( 'show_on_front', 'page' );