加入以下代码(在4.74版本测试通过)至当前主题functions.php用做登录后自动跳转到主页:
function my_login_redirect($redirect_to, $request){
if( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() )
return home_url('');
else
return $redirect_to;
}
add_filter('login_redirect', 'my_login_redirect', 10, 3);