Created
October 7, 2016 23:14
-
-
Save Phoenix2k/ccc81b44d56d71e747bfe3edee62ca0d to your computer and use it in GitHub Desktop.
WordPress: How to check if you're on the login/register page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Both login and register page | |
if ( isset( $GLOBALS[ 'pagenow' ] ) && ( false === in_array( $GLOBALS[ 'pagenow' ], array( 'wp-login.php', 'wp-register.php' ) ) ) ) { | |
// Do something | |
} | |
// Login page only | |
if ( isset( $GLOBALS[ 'pagenow' ] ) && ( false === in_array( $GLOBALS[ 'pagenow' ], array( 'wp-login.php' ) ) ) ) { | |
// Do something | |
} | |
// Register page only | |
if ( isset( $GLOBALS[ 'pagenow' ] ) && ( false === in_array( $GLOBALS[ 'pagenow' ], array( 'wp-register.php' ) ) ) ) { | |
// Do something | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment