Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#44575 closed defect (bug) (duplicate)

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

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


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 3 years ago.
Change in preg_match to allow user to add site form wp-signup.php with hyphens

Download all attachments as: .zip

Change History (4)

#1 @colomet
3 years ago

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




Version 2, edited 3 years ago by colomet (previous) (next) (diff)

3 years ago

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

#2 @ianbelanger
3 years ago

#44573 was marked as a duplicate.

#3 @jeremyfelt
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from 4.9.7 to 3.0

Hi @greatislander, thanks for the ticket! Sorry for coming through so late. This appears to be a duplicate of #20019. I'm going to close this ticket so that we can focus on a solution there.

Is there a reason for this discrepancy?

My hunch is that it is related to how signups were originally handled in b2++. The username (also site) that someone signed up with would translate to the DB table prefix for that site: b2_jeremyfelt_posts, etc... so only a limited set of characters were allowed.

Note: See TracTickets for help on using tickets.