Created
April 22, 2015 23:30
-
-
Save cdillon/59033a52ba9796930e6e to your computer and use it in GitHub Desktop.
require minimum length for WordPress user login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Additional registration checks. | |
* | |
* This filter is documented in wp-includes/user.php | |
*/ | |
function my_registration_errors( $errors, $sanitized_user_login, $user_email ) { | |
if ( strlen( $sanitized_user_login ) < 5 ) { | |
$errors->add( 'username_too_short', __( '<strong>ERROR</strong>: Username must be at least 5 characters.' ) ); | |
} | |
return $errors; | |
} | |
add_filter( 'registration_errors', 'my_registration_errors', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment