Title: email_exists
Published: April 25, 2014
Last modified: February 24, 2026

---

# email_exists( string $email ): int|false

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#return)
 * [More Information](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#wp--skip-link--target)

Determines whether the given email exists.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#description)󠁿

For more information on this and similar theme functions, check out the [ Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/)
article in the Theme Developer Handbook.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#parameters)󠁿

 `$email`stringrequired

The email to check for existence.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#return)󠁿

 int|false The user ID on success, false on failure.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#more-information)󠁿

This function will check whether or not a given email address ($email) has already
been registered to a username, and returns that users ID (or false if none exists).
See also [username_exists](https://developer.wordpress.org/reference/functions/username_exists/).

This function is normally used when a user is registering, to ensure that the E-
mail address the user is attempting to register with has not already been registered.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#source)󠁿

    ```php
    function email_exists( $email ) {
    	$user = get_user_by( 'email', $email );
    	if ( $user ) {
    		$user_id = $user->ID;
    	} else {
    		$user_id = false;
    	}

    	/**
    	 * Filters whether the given email exists.
    	 *
    	 * @since 5.6.0
    	 *
    	 * @param int|false $user_id The user ID associated with the email,
    	 *                           or false if the email does not exist.
    	 * @param string    $email   The email to check for existence.
    	 */
    	return apply_filters( 'email_exists', $user_id, $email );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/user.php#L2094)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/user.php#L2094-L2112)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#hooks)󠁿

 [apply_filters( ’email_exists’, int|false $user_id, string $email )](https://developer.wordpress.org/reference/hooks/email_exists/)

Filters whether the given email exists.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#related)󠁿

| Uses | Description | 
| [get_user_by()](https://developer.wordpress.org/reference/functions/get_user_by/)`wp-includes/pluggable.php` |

Retrieves user info by a given field.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [WP_REST_Users_Controller::update_item()](https://developer.wordpress.org/reference/classes/wp_rest_users_controller/update_item/)`wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php` |

Updates a single user.

  | 
| [send_confirmation_on_profile_email()](https://developer.wordpress.org/reference/functions/send_confirmation_on_profile_email/)`wp-includes/user.php` |

Sends a confirmation request email when a change of user email address is attempted.

  | 
| [edit_user()](https://developer.wordpress.org/reference/functions/edit_user/)`wp-admin/includes/user.php` |

Edit user settings based on contents of $_POST

  | 
| [register_new_user()](https://developer.wordpress.org/reference/functions/register_new_user/)`wp-includes/user.php` |

Handles registering a new user.

  | 
| [wp_insert_user()](https://developer.wordpress.org/reference/functions/wp_insert_user/)`wp-includes/user.php` |

Inserts a user into the database.

  | 
| [wpmu_validate_user_signup()](https://developer.wordpress.org/reference/functions/wpmu_validate_user_signup/)`wp-includes/ms-functions.php` |

Sanitizes and validates data required for a user sign-up.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#comment-content-720)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/email_exists/#comment-720)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Femail_exists%2F%23comment-720)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Femail_exists%2F%23comment-720)
 4.  **Example**
      If the E-mail exists, echo the ID number to which the E-mail is registered.
     Otherwise, tell the viewer that it does not exist.
 5.      ```php
         $email = 'myemail@example.com';
         $exists = email_exists( $email );
         if ( $exists ) {
         	echo "That E-mail is registered to user number " . $exists;
         } else {
         	echo "That E-mail doesn't belong to any registered users on this site";
         }
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Femail_exists%2F%3Freplytocom%3D720%23feedback-editor-720)
 7.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/email_exists/?output_format=md#comment-content-4760)
 8.    [pave1](https://profiles.wordpress.org/pave1/)  [  5 years ago  ](https://developer.wordpress.org/reference/functions/email_exists/#comment-4760)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Femail_exists%2F%23comment-4760)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Femail_exists%2F%23comment-4760)
 10. Bear in mind: this function is not defined in `SHORTINIT`
 11.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Femail_exists%2F%3Freplytocom%3D4760%23feedback-editor-4760)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Femail_exists%2F)
before being able to contribute a note or feedback.