在特定链接上注册后重定向

时间:2018-08-16 作者:2567655222

我想使用registration\\u redirect让用户重定向到特定页面,前提是他们使用特定链接注册。具体来说,我希望他们从注册链接here 注册,然后返回他们来自的链接-但仅限于此实例,而不是全局。

是否有一种简单的方法可以实现此特定链接?可能是一个registration\\u重定向函数,它为页面指定指向注册的链接,然后指定要返回的链接?

1 个回复
SO网友:1naveengiri

试试这首颂歌,别忘了换

例如:http://test.com/custom_pagecustom\\u page=>(使用当前注册页slug更改)

更改此链接\'http://customlink.com/asdasda/\' => (更改要重定向的位置)

$registration\\u redirect=http://customlink.com/asdasda/\'

add_filter( \'registration_redirect\', \'my_redirect_home\' );
function my_redirect_home( $registration_redirect ) {
    global $post;
    $post_slug=$post->post_name;
    if( \'custom_page\' === $post_slug ){
        $registration_redirect = \'http://customlink.com/asdasda/\';
    }
    return $registration_redirect;
}

结束

相关推荐