Php 用户注册后重定向到特定页面

Php 用户注册后重定向到特定页面,php,redirect,woocommerce,Php,Redirect,Woocommerce,一旦人们在WooCommerce注册页面上注册,我将尝试将他们重定向到特定页面(post id 27)。我试过两种不同的密码,但运气不好 /* Test 1 */ function filter_woocommerce_registration_redirect( $var ) { // make filter magic happen here... return get_page_link(27); // 3598 id page id. }; add_filter

一旦人们在WooCommerce注册页面上注册,我将尝试将他们重定向到特定页面(post id 27)。我试过两种不同的密码,但运气不好

/* Test 1 */

function filter_woocommerce_registration_redirect( $var ) { 
    // make filter magic happen here... 
    return get_page_link(27); // 3598 id page id.
}; 

add_filter( 'woocommerce_registration_redirect', 
    'filter_woocommerce_registration_redirect', 10, 1 );

/* Test 2 */

add_filter( 'woocommerce_registration_redirect', 'custom_redirection_after_registration', 10, 1 );
function custom_redirection_after_registration( $redirection_url ){
    // Change the redirection Url
    $redirection_url = get_home_url(); // Home page

    return $redirection_url; // Always return something
}

你的代码对我有用。尝试设置更高的优先级,例如:
add_filter('woocommerce_registration_redirect','filter_woocommerce_registration_redirect',999,1)。感谢您的快速回复。谢谢,真奇怪。这对我不起作用。我尝试添加更高的优先级,但仍然没有结果。请尝试将
woocommerce\u registration\u redirect
过滤器替换为
registration\u redirect