Last Updated: July 08, 2018
·
3.172K
· alettieri

Redirect and change the Registration Page in WordPress

I needed a way to re-direct any visits to the WordPress default registration page. I'm using Gravity forms and the User Registration add-on to register users on a WordPress site.

I also have a custom page dedicated to handling user registrations.

I put this code in a mu-plugins file.

<?php

class SiteRules {

    /**
     * Redirect anyone visiting the wordpress register link to the /register page
     */
    public function redirect_register($link) {
        wp_redirect( wp_registration_url() );
        exit();
    }

    /**
     * Rewrite the reigster url
     */
    public function register_url($url) {
        return home_url( '/register' );
    }

}
//
// Rewrite the register url to the custom page
//
add_filter( 'register_url', array( SiteRules, 'register_url' ) );
//
// Redirect the registration form
//
add_action( 'login_form_register', array( SiteRules, 'redirect_register' ) );

2 Responses
Add your response

How would this be handled for login page instead? Thanks

over 1 year ago ·

I just want to thank you so much for saving my life!!! Been trying to do this for two hours.

over 1 year ago ·