WordPress.org

Make WordPress Core

Ticket #44575: 44575.diff

File 44575.diff, 836 bytes (added by irfanbajwa, 17 months ago)

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

  • wp-includes/ms-functions.php

    diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php
    index f2dbbc750f..37867626d9 100644
    a b  
    55 * @package WordPress
    66 * @subpackage Multisite
    77 * @since 3.0.0
     8 * @since 4.9.7
    89 */
    910
    1011/**
    function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) { 
    617618                $errors->add( 'blogname', __( 'Please enter a site name.' ) );
    618619        }
    619620
    620         if ( preg_match( '/[^a-z0-9]+/', $blogname ) ) {
    621                 $errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) and numbers.' ) );
     621        if ( preg_match( '/[^a-z0-9-]+/', $blogname ) ) {
     622                $errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) , hyphens  and numbers.' ) );
    622623        }
    623624
    624625        if ( in_array( $blogname, $illegal_names ) ) {