Php 如何让代码重定向到我想要的URL?
我想告诉这部分代码在woocommerce注册(wordpress)后转到我想要的URL。它是开源插件的一部分。我知道重定向应该发生在这里,但我不知道如何告诉它转到注册成功页面。 电子商务注册后进入首页Php 如何让代码重定向到我想要的URL?,php,wordpress,redirect,woocommerce,Php,Wordpress,Redirect,Woocommerce,我想告诉这部分代码在woocommerce注册(wordpress)后转到我想要的URL。它是开源插件的一部分。我知道重定向应该发生在这里,但我不知道如何告诉它转到注册成功页面。 电子商务注册后进入首页 /* * This function is executed just after a new user is made from woocommerce registration form in myaccount page. * Its hooked into 'woocommerce_
/*
* This function is executed just after a new user is made from woocommerce registration form in myaccount page.
* Its hooked into 'woocommerce_registration_redirect' filter.
* If restrict user setting is enabled from the plugin settings screen, then this function will logs out the user.
*/
public function redirect_new_user($redirect)
{
if ($this->is_new_user_email_sent
&& !XlWUEV_Common::$is_xlwuev_resend_link_clicked
&& !defined('WC_DOING_AJAX')
&& !is_order_received_page())
{
$redirect = add_query_arg(array('xlrm' => base64_encode($this->user_id), ), $redirect);
$is_xlwuev_restrict_user = XlWUEV_Common::get_setting_value('wuev-general-settings', 'xlwuev_restrict_user');
if ('1' == $is_xlwuev_restrict_user)
wp_logout();
}
return $redirect;
}
试试下面的代码。请将此代码放入活动主题的functions.php中
function iconic_register_redirect( $redirect ) {
wp_redirect(get_the_permalink(2)); //// instead of 2 put the slug or id
exit();
}
add_filter( 'woocommerce_registration_redirect', 'iconic_register_redirect' ,99,1);
它仍然会以优先权重定向到homepageTry。如果它仍然不起作用,我会更新代码。您可以告诉我您的系统中还有哪些其他插件吗?谢谢。我把它放在我的主题的functions.php中,现在我得到了错误500。xxxxx.com当前无法处理此请求。HTTP错误500check现在我这边有一些语法错误,它再次返回主页。