WordPress.org

Make WordPress Core

Opened 10 days ago

Last modified 9 days ago

#44575 new defect (bug)

Network administrators are allowed to register sites with hyphens, but wpmu_validate_blog_signup disallows hyphens

Reported by: greatislander Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.7
Component: Networks and Sites Keywords: needs-patch
Focuses: multisite Cc:

Description

As a network administrator, I can register a site with a hyphen in the URL from /wp-admin/network/site-new.php (see here: https://github.com/WordPress/WordPress/blob/master/wp-admin/network/site-new.php#L237). The guide text says:

Only lowercase letters (a-z), numbers, and hyphens are allowed.

However, as a user on wp-signup.php, I can only use lowercase letters and numbers and this is enforced by wpmu_validate_blog_signup() (see here: https://github.com/WordPress/WordPress/blob/master/wp-admin/network/site-new.php#L237). The error message says:

Site names can only contain lowercase letters (a-z) and numbers.

Is there a reason for this discrepancy? As a network admin, it means that I have different URL options depending on where I register a site, which is counterintuitive. Ideally the same URL options would be available for site registration wherever it happens.

Attachments (1)

44575.diff (836 bytes) - added by irfanbajwa 10 days ago.
Change in preg_match to allow user to add site form wp-signup.php with hyphens

Download all attachments as: .zip

Change History (3)

#1 @colomet
10 days ago

I like to have - (also because is the same way the post are created), it help to understand if we have a site name created by two different names or more, like:

/site-test/

/tolkien-russian/

/spanish-begginer-vocabulary/

Last edited 10 days ago by colomet (previous) (diff)

@irfanbajwa
10 days ago

Change in preg_match to allow user to add site form wp-signup.php with hyphens

#2 @ianbelanger
9 days ago

#44573 was marked as a duplicate.

Note: See TracTickets for help on using tickets.