Php Woocommerce重定向给了我一个严重错误

Php Woocommerce重定向给了我一个严重错误,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我发现,在向购物车添加商品后,如果客户未登录,则会将其重定向到登录页面。目前我遇到了一个错误,我认为我没有正确地编辑代码 function wpse_131562_redirect() { if ( ! is_user_logged_in() && (is_cart() || is_checkout()) ) { // feel free to customize the following line to suit

我发现,在向购物车添加商品后,如果客户未登录,则会将其重定向到登录页面。目前我遇到了一个错误,我认为我没有正确地编辑代码

function wpse_131562_redirect() {
    if (
        ! is_user_logged_in()
        && (is_cart() || is_checkout())
    ) {
        // feel free to customize the following line to suit your needs
        wp_redirect('myshop.co.uk/sign-in'());
        exit;
    }
}
add_action('template_redirect', 'wpse_131562_redirect');

是的,wp_redirect函数错误


wp\u重定向('https://myshop.co.uk/sign-in' );
应该在不使用https://的情况下执行作业

。您应该使用home-url-dynamic,并尝试以下代码

wp_redirect(get_home_url().'/sign-in');