WP_User::exists() WordPress Method
The WP_User::exists() method is used to check if a user exists in the WordPress database. This is useful for checking if a user exists before creating a new user or updating an existing user.
WP_User::exists() #
Determines whether the user exists in the database.
Return
(bool) True if user exists in the database, false if not.
Source
File: wp-includes/class-wp-user.php
public function exists() { return ! empty( $this->ID ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.4.0 | Introduced. |