I am using "front-end-only-users" plugin for user registration and log in system. Now how i check that my front end user is log in or not through coding i use 'is_user_logged_in()' but it checking the admin panel user.

3 Answers 3


write this code in front page to check user is login or not:

 if ( is_user_logged_in() ) { ... } 

Hope this will helful to you

global $current_user; // Use global
get_currentuserinfo(); // Make sure global is set, if not set it.
if ( user_can( $current_user, "subscriber" ) ) 
    echo 'User is a Subscriber';
    echo 'User is not a Subscriber';
  • how to check the user id.
    – Nasir khan
    Jun 23, 2015 at 7:06
  • by using this you can find the user id get_current_user_id( );
    – Anam Shah
    Jun 23, 2015 at 7:08
  • echo get_current_user_id(); give me 0 if user login or logout.
    – Nasir khan
    Jun 23, 2015 at 7:15
  • $user_id = get_current_user_id(); if ($user_id == 0) { echo 'You are currently not logged in.'; } else { echo 'You are logged in as user '.$user_id; }
    – Anam Shah
    Jun 23, 2015 at 7:16

The CheckLoginCookie() function will help you to get the current login username

you can get the username by using bellow code

$UserCookie = CheckLoginCookie();
$username  = $UserCookie['Username'];
  // User Login
   // User Not login

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.