Source View: validate_username

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
27
28 /**
29  * Checks whether an username is valid.
30  * @param string $username Username.
31  * @return bool A filtered boolean.
32  */
33 function validate_username( $username ) {
34      $sanitized = sanitize_user( $username, true );
35      $valid = ( $sanitized == $username );
36      return apply_filters( 'validate_username', $valid, $username );
37 }
38
39 /**
40  * Insert an user into the database.
41  * @global object $wpdb WordPress database layer.
42  * @param array $userdata An array of user data.
43  * @return int The newly created user's ID.
44  */
45 function wp_insert_user($userdata) {