Created
December 20, 2012 01:15
-
-
Save norcross/4342231 to your computer and use it in GitHub Desktop.
check login URL for specific query string
This file contains 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 | |
/* | |
* Check the URL of the WordPress login | |
* page for a specific query string | |
* | |
* assumes login string is | |
* http://mysite.com/wp-login.php?question=answer | |
*/ | |
function rkv_login_stringcheck() { | |
// set the location a failed attempt goes to | |
$redirect = 'http://www.google.com/'; | |
// missing query string all together | |
if (!isset ($_GET['question']) ) | |
wp_redirect( esc_url_raw ($redirect), 302 ); | |
// incorrect value for query string | |
if ($_GET['question'] !== 'answer' ) | |
wp_redirect( esc_url_raw ($redirect), 302 ); | |
} | |
add_action( 'login_init', 'rkv_login_stringcheck' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment