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

There are functions for is_home(), is_blog() is_single() etc...

What's the best way to tell if I'm on a page that is requesting that I login? I guess that would just be the wp-login.php page.

share|improve this question
up vote 5 down vote accepted

Paste this function in your functions.php or a plugin file:

function is_login_page() {
    return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));

and then you can use it like this:

  //this is a login page
  //not the page you are looking for
share|improve this answer
i would suggest wrapping it in !function_exists('is_login_page'){} for forward compatibility, but yes this does exactly what i want. thank you. – cwd Sep 9 '11 at 13:58

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.