I just installed wordpress with WooCommerce for my website. WooCommerce has my Account page which has been automatically created for me. However, whenever I created an account as an user, it will directly lead me to the wp-admin, which is very dangerous because someone can stole my website using this function.
Why WooCommerece My Account page linked to wp-admin everytime we logged in? I was searching for hours of this question but there is no answer. So please help.
Thanks in advance.
CodePudding user response:
Try this code.
<?php
// Redirect a user , after Login.
add_filter( 'woocommerce_login_redirect', 'filter__woocommerce_login_redirect', 10, 2 );
function filter__woocommerce_login_redirect( $redirect, $user ) {
$redirect = ""; // Add your custom URL here.
return $redirect;
}
CodePudding user response:
You can change that in WordPress wp-admin by logging as the admin of the site. On the left-hand-side panel, select > Settings > General.
If you are ok that people can subscribe to your site and can log-in, choose from where it says 'Membership' and checkmark that box. Just below, you will see what role the new subscriber can have, which is by default, 'Subscriber'. I would leave it at that.
Whoever set up your WordPress site possibly selected 'Administrator', to which I agree, it is dangerous. And it does not make sense to me why that even is an option.
Just to add, this is not a Woocommerce issue, which is why you possibly were down-voted. It is WordPress issue.