[ad_1]
Hello @jaikrmandal,
Thanks for reaching out to us! I looked into this case and created the following code snippet:
/* Redirect non-logged in users from the My Account page to the Login form. */
function redirect_to_login() {
if ( is_account_page() && ! is_user_logged_in() ) {
wp_redirect(wp_login_url());
exit;
}
}
add_action( 'template_redirect', 'redirect_to_login' );You can add this to your site using the Code Snippets plugin. Please note that we usually don’t create custom code snippets. Given that this is a fairly simply code snippet, I made an exception, though. Please also note that this code snippet does exactly what you asked for: It redirects non-logged in users, that try to access the My Account page to the WordPress login form. This might not be what a customer expects to see.
