wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



validate_username › WordPress Function

Da2.0.1
Deprecaton/a
validate_username ( $username )
Parametri:
  • (string) $username Username.
    Richiesto:
Ritorna:
  • (bool) Whether username given is valid.
Definito a:
Codex:
ChangeLog:
  • 4.4.0

Checks whether a username is valid.



Sorgenti

function validate_username( $username ) {
	$sanitized = sanitize_user( $username, true );
	$valid     = ( $sanitized == $username && ! empty( $sanitized ) );

	/**
	 * Filters whether the provided username is valid.
	 *
	 * @since 2.0.1
	 *
	 * @param bool   $valid    Whether given username is valid.
	 * @param string $username Username to check.
	 */
	return apply_filters( 'validate_username', $valid, $username );
}