Multisite: setting theme and options when a new blog is created

The best hook I can find is wpmu_new_blog (line 1086, wp-includes/ms-functions.php, wpmu_create_blog()) – it passes 6 arguments like so;

do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta );

$meta is an array of initial site options, not to be confused with the options generated by populate_options().

Programatically creating nav menus may prove to be a little tricky, as there is no ‘API’ as such – they’re a mix of posts, post meta and nav_menu terms, coupled with a few available functions such as is_nav_menu_item() and wp_setup_nav_menu_item().

My best advice would be to check out wp-admin/nav-menus.php, as this is where all the core code lies for creating menus.

Using WP_DEFAULT_THEME should be fine, and is probably the best approach too.

Leave a Comment