Last active
July 15, 2016 18:40
-
-
Save briankompanee/a07e4e6bdc8a701b77f628bea7e01557 to your computer and use it in GitHub Desktop.
WordPress: Customize URL for default registration on wp-login page.
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
<?php | |
/** | |
* Customize URL for default registration on wp-login page. | |
* Add to functions.php | |
**/ | |
function wp_kompanee_register_url($link){ | |
//Change wp-login registration url | |
return str_replace(site_url('wp-login.php?action=register', 'login'),site_url('register', 'login'),$link); | |
} | |
add_filter('register', 'wp_kompanee_register_url'); | |
function wp_kompanee_fix_register_urls($url, $path, $orig_scheme){ | |
//Override other default registration links | |
//http://en.bainternet.info/2012/wordpress-easy-login-url-with-no-htaccess | |
if ($orig_scheme !== 'login') | |
return $url; | |
if ($path == 'wp-login.php?action=register') | |
return site_url('register', 'login'); | |
return $url; | |
} | |
add_filter('site_url', 'wp_kompanee_fix_register_urls', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment