[wp-trac] [WordPress Trac] #43306: Creating site using wpmu_create_blog() without / prefixed with $path causes get_id_from_blogname() to fail.
WordPress Trac
noreply at wordpress.org
Mon Apr 1 21:59:02 UTC 2019
#43306: Creating site using wpmu_create_blog() without / prefixed with $path causes
get_id_from_blogname() to fail.
--------------------------+------------------------------
Reporter: aubreypwd | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.9.4
Severity: normal | Resolution:
Keywords: | Focuses: multisite
--------------------------+------------------------------
Comment (by aubreypwd):
This does seem to be limited to subdomain setup.
When running:
{{{#!php
<?php
add_action( 'init', function() {
if ( wp_doing_ajax() ) {
return;
}
if ( ! isset( $_GET['create' ] ) ) {
return;
}
$id = wpmu_create_blog( $_SERVER['HTTP_HOST'], 'example1',
'example1', 1 );
$result = get_id_from_blogname( 'example1' );
error_log( "example1: $id -> $result" );
$id = wpmu_create_blog( $_SERVER['HTTP_HOST'], '/example2',
'example2', 1 );
$result = get_id_from_blogname( 'example2' );
error_log( "example2: $id -> $result " );
wp_redirect( admin_url( 'network/sites.php' ) );
exit;
} );
}}}
... as a `mu-plugin`, I get the following results:
{{{
[01-Apr-2019 21:54:30 UTC] example1: 15 ->
[01-Apr-2019 21:54:32 UTC] example2: 16 ->
[01-Apr-2019 21:54:41 UTC] example1: 8 -> 8
[01-Apr-2019 21:54:42 UTC] example2: 9 -> 9
}}}
The first two are on the sub-domain setup, the next 2 are on a sub-
directory setup. For some reason, right after creating a site, I can't
call the site {{{get_id_from_blogname}}} on a sub-domain setup.
This is also testing on {{{trunk}}}.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43306#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list