is_user_logged_in()WP 2.0.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.

1 time — 0.000012 sec (very fast) | 50000 times — 0.01 sec (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 5.9.3

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

	return $user->exists();