Support » Fixing WordPress » is_user_logged_in function outside of WordPress

  • I want to somehow use this function on a non-wordpress page :

    if (is_user_logged_in()){
        echo "Welcome, registered user!";
    else {
        echo "Welcome, visitor!";

    Is there any way to do this? I was told it is possible if I include my wp-header.php in the Non-wordpress page, but I do not want to do this. Any other methods?

Viewing 2 replies - 1 through 2 (of 2 total)
  • any answers?

    Hi Virendar,

    I’m curious if you were able to figure this one out? I was able to get that function to work, but only if my file(s) lived inside the WordPress directory. I need it work outside the WP directory and am not having any luck.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_user_logged_in function outside of WordPress’ is closed to new replies.