Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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);
}
add_filter('register','wpse127636_register_url');

function wpse127636_fix_register_urls($url, $path, $orig_scheme){
    /*
        Site URL hack to overwrite register url     
        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', 'wpse127636_fix_register_urls', 10, 3);
share|improve this answer
    
works well. thanks –  pulla Dec 29 '13 at 6:23

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 */
share|improve this answer
1  
Add some explanation saying how this code fits for the Question. –  Mayeenul Islam Jul 16 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 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. –  pcparts Jul 19 at 10:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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