Last active
December 31, 2015 18:29
-
-
Save allanemerson/8027311 to your computer and use it in GitHub Desktop.
This will change the output of the log in/out links generated by Wordpress and allows for a pretty log in/out URL.
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
///// In your .htaccess: ///// | |
RewriteRule ^login$ wp/wp-login.php | |
///// In your functions file: ///// | |
function wplogin_filter( $url, $path, $orig_scheme ) { | |
// The logout link in the admin bar will does not include a direct. | |
// So, when you hit wp-login.php, the logout is completed and the page does a redirect to itself with 'loggedout=true' appended | |
// This results in a 404 with the new .htaccess rule in place. So, skip this filter on the admin logout link and all is well. | |
if( is_admin() ) | |
return $url; | |
$old = array( "/(wp\/wp-login\.php)/"); | |
$new = array( "login"); | |
return preg_replace( $old, $new, $url, 1); | |
} | |
add_filter('site_url', 'wplogin_filter', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment