Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#16913 closed defect (bug) (duplicate)

install_blog() does not work correctly when called multiple times

Reported by: westi Owned by:
Milestone: Priority: normal
Severity: major Version: 3.1
Component: Multisite Keywords:
Focuses: Cc:


If you want to pre-populate your multisite network with a big group of new blogs to streamline importing from another multisite CMS or another multisite install you can't create a single php script to pre-create all the blogs and there tables.

Something like this will create the blogs in wp_blogs but only install the tables for the first blog due to the way the table schemas are calculate at include time.

function wp_footer_hooked() {
	$new_blog_id = wpmu_create_blog( 'importone.multisite.domain', '',  'Import One', 1 );
	$new_blog_id = wpmu_create_blog( 'importtwo.multisite.domain', '',  'Import Two', 1 );
add_action('wp_footer', 'wp_footer_hooked');

I think the best fix for this is to change wp-admin/includes/schema.php to return the schema info via a functions rather than at include time (for back compat we can still set the global var up but not use it in core)

Change History (2)

comment:1 @solarissmoke5 years ago

  • Keywords needs-patch removed
  • Resolution set to duplicate
  • Status changed from new to closed

comment:2 @ocean905 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.