Make WordPress Core


Ignore:
Timestamp:
05/09/2017 02:58:39 PM (9 years ago)
Author:
flixos90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r40486 r40589  
    578578                $errors->add('blogname',  __( 'That name is not allowed.' ) );
    579579
    580         if ( strlen( $blogname ) < 4 ) {
    581                 $errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
     580        /**
     581         * Filters the minimum site name length required when validating a site signup.
     582         *
     583         * @since 4.8.0
     584         *
     585         * @param int $length The minimum site name length. Default 4.
     586         */
     587        $minimum_site_name_length = apply_filters( 'minimum_site_name_length', 4 );
     588
     589        if ( strlen( $blogname ) < $minimum_site_name_length ) {
     590                /* translators: %s: minimum site name length */
     591                $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 ) ) );
    582592        }
    583593
Note: See TracChangeset for help on using the changeset viewer.