wpf_get_current_user()

Overview

This function works similarly to the wp_get_current_user function, but it will also work during an auto-login session.

The function will return a WP_User object, or false if the user isn’t known.

Get the current user

$user = wpf_get_current_user();
if ( false !== $user ) {
	echo $user->user_email; // The email address of the current user, or temporary auto-login user
}

Was this helpful?