Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#43306 new defect (bug)

Creating site using wpmu_create_blog() without / prefixed with $path causes get_id_from_blogname() to fail.

Reported by: aubreypwd Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.4
Component: General Keywords:
Focuses: multisite Cc:


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:


Change History (1)

#1 @johnjamesjacoby
5 months ago

Without looking, there might be a distinction here between subdomain and subdirectory installations.

Was this on a subdirectory network, where it's expecting to see a site as /this?

Note: See TracTickets for help on using tickets.