Function: username_exists

username_exists( string $username )

Determines whether the given username exists.

For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.

Parameters

Name Type(s) Default Value Description
$username string

Username.

Returns

integer | false

The user's ID on success, and false on failure.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.