wpseek.com
A WordPress-centric search engine for devs and theme authors



is_email › WordPress Function

Since0.71
Deprecatedn/a
is_email ( $email, $deprecated = false )
Parameters: (2)
  • (string) $email Email address to verify.
    Required: Yes
  • (bool) $deprecated Deprecated.
    Required: No
    Default: false
Returns:
  • (string|false) Valid email address on success, false on failure.
Defined at:
Codex:

Verifies that an email is valid.

This accepts the addresses that matches the WHATWG specifications, i.e. what browsers use for <input type=email>. It also accepts some additional addresses. By default this accepts addresses like info@grå.org (also accepted by Firefox) <input type=email>. You can disable Unicode support by using the wp_is_ascii_email filter instead of wp_is_unicode_email, which is the default.


Source

function is_email( $email, $deprecated = false ) {
	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '3.0.0' );
	}

	/**
	 * Filters whether an email address is valid.
	 *
	 * This filter is evaluated under several different contexts, such as
	 * 'local_invalid_chars', 'domain_no_periods', or no specific context.
	 * Filters registered on this hook perform the actual validation; the
	 * default filter is registered in default-filters.php.
	 *
	 * @since 2.8.0
	 *
	 * @param string|false $is_email The email address if successfully passed the is_email() checks, false otherwise.
	 * @param string       $email    The email address being checked.
	 * @param string|null  $context  Context under which the email was tested, or null for the initial call.
	 */
	return apply_filters( 'is_email', false, $email, null );
}