WordPress at a glance

is_user_logged_in() WP 1.0

Checks if the current visitor is a logged in user.

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

Function replacement (override) — in a plugin you can create a function with the same name, then it will 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.



Code of is_user_logged_in: wp-includes/pluggable.php VER 4.9.8

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
    Hello, !     Log In . Register