I am just trying to change the url of "register" on wp default login page(domain.com/wp-login.php)

  1. I want to change the url on register link.

  2. when you are on domain.com/wp-login.php?action=register, I want to redirect to domain.com/register

I have added redirect link. but it's not working.

 RedirectMatch 301 /wp-login.php?action=register$ http://domain.com/register/$1

Am I missing something?

I just want to use my register page (domain.com/register/)

3 Answers 3


Code from @bainternet's website.

function wpse127636_register_url($link){
        Change wp registration url
    return str_replace(site_url('wp-login.php?action=register', 'login'),site_url('register', 'login'),$link);

function wpse127636_fix_register_urls($url, $path, $orig_scheme){
        Site URL hack to overwrite register url     
    if ($orig_scheme !== 'login')
        return $url;

    if ($path == 'wp-login.php?action=register')
        return site_url('register', 'login');

    return $url;
add_filter('site_url', 'wpse127636_fix_register_urls', 10, 3);

Put this code in your Theme's "functions.php" file. Replace the page ID with where it says [REPLACE WITH YOUR PAGE ID HERE].

/* start  */ 
add_filter( 'register_url', 'custom_register_url' );
function custom_register_url( $register_url )
    $register_url = get_permalink( $register_page_id = [REPLACE WITH YOUR PAGE ID HERE] );
    return $register_url;
/* end */
  • 2
    Add some explanation saying how this code fits for the Question. Commented Jul 16, 2014 at 4:08
  • No it's not working I added post id but when I go to /wp-login, it doesn't redirect. anyway thank you.
    – pulla
    Commented Jul 16, 2014 at 7:04
  • It should work if dont correctly. did you add the numerical value of the page, to which you want to redirect? PS: you don't need to edit or change anything on the wp-login.php file itself. Just add this code in the functions.php file will do. Commented Jul 19, 2014 at 10:59
  • It does work. Thank you! Commented May 20, 2022 at 22:15
  • It’s probably obvious to most but don’t include the square brackets :)
    – David P
    Commented Sep 2, 2023 at 5:26

Use the register_url filter

add_filter( 'register_url', 'change_my_register_url' );
    function change_my_register_url( $url ) {
        if( is_admin() ) {
            return $url;
        return "/custom-register-url/";
  • Why the is_admin() exception? (I'm just curious, I could believe it's right)
    – Rup
    Commented Jan 13, 2022 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.