Redirect WordPress Registrations to WooCommerce
Why redirect WordPress Registrations to WooCommerce? A lot of spam registrations come from the default WordPress registration form. Maybe because it just has just two fields, username, and email as shown below.
Tip: You can stop spam registrations by enabling Captcha on registration forms.
Enabling membership registration in WordPress
WordPress has a default registration form. The form is found on the default login page /wp-admin or /wp-login.php
The link to this default form is located here /wp-login.php?action=register
Note: You may not see the link to the registration form on your admin login screen. If your site needs a membership function, then registration is necessary. To enable this link/registration, go to Settings > General and check “Anyone can register” as shown below.
Also read: Proven ways to increase WordPress speed and performance
In a website that runs WooCommerce, you’d want all your registrations to come from clients who have purchased products and not random signups.
Enabling registrations on “My Account” page by Woocommerce
When you install WooCommerce, it automatically creates pages. For example: cart, checkout, and my account, etc. Therefore, to enable registration on my account page, go to WooCommerce > Settings > Accounts and Privacy as shown below.
Save the new options. You will now have a login and registration form on the /my-account page of your website.
So, how do we redirect WordPress Registrations to Woocommerce?
You can redirect registrations using two methods:
1. Via functions.php
Just add the code below to your theme’s functions.php file.
function my_registration_page_redirect() { global $pagenow; if ( ( strtolower($pagenow) == 'wp-login.php') && ( strtolower( $_GET['action']) == 'register' ) ) { wp_redirect( home_url('/my-account')); } } add_filter( 'init', 'my_registration_page_redirect' );
Tip: To redirect user registration to a custom registration page, change the ‘my-account’ slug to your custom URL.
2. Using a plugin
However, if you prefer a plugin, download the plugin by clicking on the link below (only 0.86kb). Install and activate it and you will be good to go.
[wpdm_package id=’3966′]Remember, this will only work after:
1. You install WooCommerce on your site
2. “My Account” page registration is enabled
For any info, do not hesitate to contact us. Of course, for fast, efficient, and cost effective web development services, fill in this form and get a free web development quotation.