Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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