[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
Tue Feb 13 19:55:05 UTC 2018
#43306: Creating site using wpmu_create_blog() without / prefixed with $path causes
get_id_from_blogname() to fail.
--------------------------+-----------------------------
Reporter: aubreypwd | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.9.4
Severity: normal | Keywords:
Focuses: multisite |
--------------------------+-----------------------------
The below code will result in `NULL`:
$id = wpmu_create_blog( 'example.org', 'example',
'neutralized', 1 );
$result = get_id_from_blogname( 'example' );
But the below code will result in an `int`.
$id = wpmu_create_blog( 'example.org', '/example',
'neutralized', 1 );
$result = get_id_from_blogname( 'example' );
The difference is in the 2nd snippet I prefix `$path` with a `/`. Without
that being apparent in docs we should strip the need for the `/` or update
docs.
I found this while writing a unit test, and you can see it changing below:
[[Image(http://aubrey.pw/d/2018/BoaRz4J88N.gif)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43306>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list