Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 2 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:

if(is_login_page()){
  //this is a login page
}else{
  //not the page you are looking for
}
share|improve this answer
1  
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

 
discard

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.