Last active
December 18, 2015 01:39
-
-
Save pmgllc/5705808 to your computer and use it in GitHub Desktop.
Stealth Login Page code snippet to add URL filter to logout/password reset. This will need to be added each time the plugin updates - add to plugin.php.
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
// After all network activate/deactivate sections, before Global Variables | |
/** | |
* Edit the logout/login/lost_password URLs to the new custom URL | |
* | |
* @since 2.1.0 | |
* @param $old | |
* @param $new | |
* @param $url | |
* @return array | |
*/ | |
add_filter('site_url', 'wplogin_filter', 10, 3); | |
function wplogin_filter( $url, $path, $orig_scheme ) { | |
global $custom_url_ending; | |
$old = array( "/(wp-login\.php)/"); | |
$new = array( $custom_url_ending ); | |
return preg_replace( $old, $new, $url, 1); | |
} | |
// Additional Global Variables that have since been removed but are needed for the filter - I don't belive the last two are used because of nonce URLs. | |
$custom_url_ending = "wp-login.php?" . $slp_options['question'] . '=' . $slp_options['answer']; | |
$custom_logged_out = $custom_url . '?loggedout=true'; | |
$custom_lost_password = $custom_url . '&action=lostpassword'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment