Roxy
(@roxannestoltz)
Hi @axswebmaster ,
Thanks for reaching out!
I understand that you have created a custom login page and would like to use this as opposed to the default WooCommerce login.
There is an extension that may help you achieve this:
https://woocommerce.com/document/redirect-after-login-registration-logout/
However, should you prefer a hard-coded option, below is a guide that may be helpful:
https://usersinsights.com/woocommerce-login-redirect/
Hope this helps 🙂
Hello @roxannestoltz
your suggestions are of no help:
1 – I don’t want use a plugin.
2 – I don’t want redirect the user after login,
I want redirect the user before the login.
I want redirect woocommerce_before_customer_login_form to my custom page.
Thanks
Hi there,
I understand you would like to use your custom login page instead of WooCommerce’s.
May I please ask which plugin did you use to create your login page? There may be an option to enable redirection/replacement of the site’s default login page.
Otherwise, would it be possible to provide us with a link to your site?
Please let me know.
Hi @prin_settasatian,
I have used the clean login plugin
https://wordpress.org/plugins/clean-login/
I can’t give you the link because the website is work in progress and is not online.
Thanks
Hi again @axswebmaster,
You could try adding the following code:
add_action( 'template_redirect', function() {
if ( is_user_logged_in() || ! is_page() ) return;
$restricted = array( 76 ); //page id to redirect from - you can include more than one page by separating each page id with a comma
if ( in_array( get_queried_object_id(), $restricted ) ) {
wp_redirect( site_url( '/test' ) ); //URL of page to redirect to; don't include full URL - just the page name
exit();
}
});
Change the lines in the code as noted by the comments.
You can use a plugin like Code Snippets (https://wordpress.org/plugins/code-snippets/) to add the code.
Let me know if you need further help.