Skip to content

Instantly share code, notes, and snippets.

@pmgllc
Last active December 18, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmgllc/5705808 to your computer and use it in GitHub Desktop.
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.
// 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