WordPress at a glance

is_user_logged_in() WP 1.0

Checks if 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.

This is a pluggable function, and it can be replaced by a plugin. It means that this function is defined (works) only after all plugins are loaded (included), but before this moment this function has not defined. Therefore, you cannot call this and all functions depended on this function directly from a plugin code. They need to be called on plugins_loaded hook or later, for example on init hook.

Function replacement (override) — in a plugin you can create a function with the same name, then it replace this function.

Works based on: wp_get_current_user()
✈ 1 time = 0.000012s = very fast | 50000 times = 0.01s = speed of light | PHP 7.0.2, WP 4.4.1

No Hooks.


true/false. True if user is logged in, false if not logged in.




Since 2.0.0 Introduced.

Code of is user logged in: wp-includes/pluggable.php WP 5.4.2

function is_user_logged_in() {
	$user = wp_get_current_user();

	return $user->exists();

Related Functions

From tag: Users (_user)

More from tag: Conditional tags (all)

More from category: Login/Logout

More from Template Tags: Authors

No comments
        Log In . Register