From the creators of Nextend Social Login: Meet Mosaic, a visual workflow built on real web fundamentals for WordPress.
Try now

How to add custom username validation logic?

You can add custom validation to the entered username using the nsl_validate_username filter.

Example

Code
add_filter('nsl_validate_username', function ($isValid, $username, $errors) {
    if (strlen($username) < 6) { $errors->add('invalid_username', '' . __('ERROR') . ':' . __('Sorry, username must contain at least 6 characters.'));
        $isValid = false;
    }
    return $isValid;
}, 10, 3);

Available since: 3.0.7

Your cookie preferences

We use cookies to improve your experience, analyze traffic, and personalize content. By clicking "Accept all" you agree to storing them on your device. Read our privacy policy.