WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using wordpress and I normally use:

if (!is_user_logged_in()){
   //something here

to detect if the wordpress user is logged in or now.

My problem is that I need to detect if the user is logged in to wordpress from a non-wordpress page.

My page is in the same directory as the other wordpress pages but is not page of wordpress.

How can I detect this from my page?

share|improve this question

Simply place

define( 'WP_USE_THEMES', false );
include 'wp-load.php';

on to of your template files (before everything else). This loads the whole WP core.

share|improve this answer

this is untested by me, but please have a look at this article: Integrating Wordpress into an Existing Site

In essence I believe that if you use:

<?php require('/the/path/to/your/wp-blog-header.php');?>

..at the top of you (php) page you should be able to take advantage of the is_user_logged_in() function.

share|improve this answer
Hi, I'm new to Stack Exchange in general, so is there a way I can see why a post is voted down? Presumably this didnt work, or did I not include enough info? – Mere Development Feb 3 '12 at 17:21
Normally the downvoter should leave a reply, but they're not forced to. – kaiser Feb 3 '12 at 23:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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