일반적으로 Woocommerce "고객"사용자 역할은 WordPress의 관리자에게 액세스 할 수 없습니다. 하지만 고전 워드 프레스 로그인 영역에 사용자를 리디렉션하는 혼합 조건 woocommerce_before_customer_login_form
후크 전당 잡히게 기능을 사용할 수 있습니다,이 방법 :
add_action('woocommerce_before_customer_login_form', 'redirect_customer_login_access');
function redirect_customer_login_access() {
// Here the conditions (woocommerce my account pages and unlogged user)
if(is_account_page() && !is_user_logged_in()){
// Define here the redirection after login (optional)
$redirection_after = site_url('/shop/');
// Redirecting to Wordpress login area
wp_redirect(wp_login_url($redirection_after));
// always use exit after wp_redirect() function.
exit;
}
}
코드 활성 자식 테마의 function.php 파일에 간다 (활성 테마 또는 모든 플러그인 파일에서).
이 코드는 테스트되었으며 작동합니다.