I have plugin which redirects myweb.com/wp-login.php to custom login page myweb.com/member-login/

I want to check if current page is either wp-login.php or /member-login/ but does not work. code below

( ( $pagenow !== 'wp-login.php') || ( $pagenow !== '/member-login/') )

Any clue why?

UPDATE: In mean time a have created

( $pagenow !== 'wp-login.php')||( !strncmp($uri,'/member-login/',strlen('/member-login/')) ) 

and check is OK

1 Answer 1


You can use is_page() to check if user is on that custom login page. So the code will be something like:

( ( $pagenow !== 'wp-login.php') || ( !is_page('member-login')) )

You can also use page id for the function.

  • thank you. check is ok, but i still have problem because WP does not detect this page.
    – Greg Skala
    Mar 12, 2017 at 10:04
  • Which plugin you're using to redirect ? Check if that plugin provides any function to check. Mar 12, 2017 at 10:08
  • my own. I use this check for enable maintainance page. if my custom login is disable then ( $pagenow !== 'wp-login.php') works I enable maintanace page for all pages except wp-login.php But if i enable my custom login then redirects works and for some reason !is_page('member-login') is not detected by enable maintanace function.
    – Greg Skala
    Mar 12, 2017 at 10:13
  • Redirect works ok.
    – Greg Skala
    Mar 12, 2017 at 10:19
  • Remember is_page needs to be used when wp_query is loaded, i.e in wp hook, not before that like init
    – Ismail
    Mar 12, 2017 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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