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.


Top ↑

Source

File: wp-includes/class-wp-user.php

	public function exists() {
		return ! empty( $this->ID );
	}

Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.