Modify registration URL

This code displays a ‘Register’ link; I want to redirect this link to “www.myDomain.com/register/” how can I change this?

<?php
  if ( get_option( 'users_can_register' ) ) :
  $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );``/*** Filter the registration URL below the login form.
  ** @since 1.5.2** @param string $registration_url Registration URL.
  */echo ' | ' . apply_filters( 'register', $registration_url );endif;?></p>

Related posts

Leave a Reply

3 comments

  1. Use the register_url filter to modify the URL returned by wp_registration_url.

    Sample code (put it in your plugin or theme/functions.php file):

    add_filter( 'register_url', 'custom_register_url' );
    function custom_register_url( $register_url )
    {
        $register_url = "YOUR_PAGE_URL";
        return $register_url;
    }
    
  2. Check this:

    <?php
    if ( get_option( 'users_can_register' ) ) :
        echo ' | ' . apply_filters( 'register', 'http://www.myDomain.com/register/' );
    endif;
    ?>
    

    Not very elegant solution, but it should work.

  3. I think you would have to edit the general-template.php. The function would be

    function wp_registration_url() {
            return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
    

    if you changed it to

    function wp_registration_url() {
            return apply_filters( 'register_url', 'http://www.mydoamin.com/register'));
    

    it should change it where ever that wp_registration_url is referenced.