Wp Login Page Change register link

Hello,

is there a way to change the registration link that exists in wordpress login page? Thank you!!

  • Sajid

    Hi loannis,
    Hope you are doing good today :slight_smile:

    Try adding following code in functions.php file of your child theme or use it as mu-plugin. This will replace the default register URL with yourdomain.com/register.

    function wpse127636_register_url($link){
        /*
            Change wp registration url
        */
        return str_replace(site_url('wp-login.php?action=register', 'login'),site_url('register'),$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);

    Hope that helps! Feel free to post a reply if you need further assistance :slight_smile:

    Best Regards,
    Sajid

  • Sajid

    Hi loannis,
    Hope you are doing good today :slight_smile:

    That were the code I found from stackoverflow and it were selected as accepted answer, so I posted it quickly for you.

    Anyway, I came up with a short version of the code using that you can change the default register link with your custom registration page link and optionally also can change the link text (from Register to Signup - maybe).

    add_filter( 'register', 'sjaved_register_link' );
    function sjaved_register_link( $link ) {
    	/*Required: Replace Register_URL with the URL of registration*/
    	$custom_register_link = 'Register_URL';
    	/*Optional: You can optionally change the register text e.g. Signup*/
    	$register_text = 'Register';
    	$link = '<a href="'.$custom_register_link.'">'.$register_text.'</a>';
        return $link;
    }

    Add above code in functions.php file of your child theme or use it as mu-plugin.

    If you take the mu-plugin route, you'll want to log into your site via FTP, and go to your /wp-content/ folder via FTP, finding the folder called "mu-plugins".

    If there's no folder with that name, then you'll want to create one. Then, create a file inside that folder, and give the file any name you like (making sure the file has an extension of .php, e.g. example.php) and paste the code in there.

    It'll always be active, so there's no need to activate the plugin after creation. Be sure to add a PHP start tag at the beginning of the code, like this:

    <?php

    Don't forget to replace the Register_URL with your very own custom registration page URL.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.