Multisite: Introduce `minimum_site_name_length` filter.

Prior to this change, the minimum site name length checked in `wpmu_validate_blog_signup()` was set to a fixed value of 4. The new filter allows tweaking this value, as there may be cases where shorter site names may be required.

Fixes #39676.

Built from https://develop.svn.wordpress.org/trunk@40589


git-svn-id: http://core.svn.wordpress.org/trunk@40459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2017-05-09 14:59:47 +00:00
parent cbf3b2cff5
commit a3797875bf
2 changed files with 13 additions and 3 deletions

View File

@ -577,8 +577,18 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
if ( in_array( $blogname, $illegal_names ) )
$errors->add('blogname', __( 'That name is not allowed.' ) );
if ( strlen( $blogname ) < 4 ) {
$errors->add('blogname', __( 'Site name must be at least 4 characters.' ) );
/**
* Filters the minimum site name length required when validating a site signup.
*
* @since 4.8.0
*
* @param int $length The minimum site name length. Default 4.
*/
$minimum_site_name_length = apply_filters( 'minimum_site_name_length', 4 );
if ( strlen( $blogname ) < $minimum_site_name_length ) {
/* translators: %s: minimum site name length */
$errors->add( 'blogname', sprintf( _n( 'Site name must be at least %s character.', 'Site name must be at least %s characters.', $minimum_site_name_length ), number_format_i18n( $minimum_site_name_length ) ) );
}
// do not allow users to create a blog that conflicts with a page on the main blog.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40588';
$wp_version = '4.8-alpha-40589';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.