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



我发现这个代码,在将商品添加到购物车后,如果客户未登录,他们将被重定向到登录页面。目前我收到错误,我认为我没有正确编辑代码。

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');

没有 https://它就会给出错误。 您应该使用主页网址动态尝试以下代码

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

是的,函数wp_redirect是错误的。

wp_redirect( 'https://myshop.co.uk/sign-in' );应该做这项工作

相关内容

最新更新