To deactivate the default registration page of WordPress (/wp-login.php?action=register
) and at the same time enable registration via WooCommerce, you can do the following:
Add the following code to the functions.php
file of your theme or use a plugin for custom code snippets to avoid direct changes to the theme files:
function disable_wp_registration() { if (isset($_GET['action']) && $_GET['action'] == 'register' && !is_admin()) { wp_redirect(home_url()); exit; } } add_action('login_init', 'disable_wp_registration');
This code checks if someone is trying to access the WordPress registration page and then redirects them to the home page (or any other page you prefer).
Comments