This question already has an answer here:

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.

marked as duplicate by bueltge, cjbj, kaiser Sep 4 '16 at 19:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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
  • 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

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