Redirecting The Registration Page

Redirecting The Registration Page

When using the Wishlist Member sidebar widget, the Register link goes to the standard Registration page for your wordpress website.

This really isn’t a great thing mainly because when someone clicks on that register link – they’re interested in becoming a member… and this is an opportunity for us to encourage our visitor to join the right membership level…

So, I’ve conducted some investigations and created a function that will detect access to the registration page, and redirect it automatically to another page of your choice…

Kudos to Callum Macdonald for the WP Block Admin plugin that gave me the basis for this code.

Add the following code to functions.php in your theme:

<?php
function twpw_redirect_init() {
$twpw_redirect_to = 'http://yourdomain.com/redirectpage/';
// Is this the registration page?
if (
// Look for the presence of /wp-login.php?action=register in the url
stripos($_SERVER['REQUEST_URI'],'/wp-login.php?action=register') || stripos($_SERVER['REQUEST_URI'],'/wp-login.php?registration=disabled') !== false
) {
// Send a temporary redirect
wp_redirect($twpw_redirect_to,302);   }
}
// Add the action with maximum priority
add_action('init','twpw_redirect_init',0);
?>

Then change the line:

$twpw_redirect_to =  'http://yourdomain.com/redirectpage';

to the page you would like to send your visitors too.

This code works if registrations are disabled in wp-admin as well.

Let me know how this goes for you – show off your efforts!

Powered by WishList Member - Membership Site Software