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/)


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. – Mayeenul Islam Jul 16 '14 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 Jul 16 '14 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. – intec infosys Jul 19 '14 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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