Determines whether the current visitor is a logged in user.
For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.
function is_user_logged_in() {
$user = wp_get_current_user();
return $user->exists();
}
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_user_logged_in