I need to check if the user has logged in to my wordpress site from a non wp page.How can this be done ?

I tried to create a plugin that check for user details and returns logged in details.But when I access the plugin from outside wp.Its always returning ‘not loggedin’

This is the code

require('../../wp-blog-header.php');
if (is_user_logged_in()){
    echo "Welcome, registered user!";
}
else {
    echo "Welcome, visitor!";
};

Which is the best way for checking this ?

Read more here: Check for logged in users from outside wp page in wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , ,

Wordpress related questions and answers: