0

I want to use registration_redirect to have users redirected to a certain page, only if they register using a certain link. Specifically, I want them to go from the registration link here to registration, and then back to the link they came from - but only for this instance, not globally.

Is there an easy way to do this for this specific link? Perhaps a registration_redirect function that specifies for the page that the link to registration is on and then specifies the link to return to?

0

Try this ode, dont forgot to change

ex: http://test.com/custom_page custom_page => ( Change with your current registration page slug )

change this link 'http://customlink.com/asdasda/' => (Change with where you want to redirect )

$registration_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;
}
10
  • whats the custom registration page url? Aug 16 '18 at 14:31
  • Would the slug simply be included with the $? like this? pastebin.com/peGG1nHL The link should redirect from the first page (/practicetest), register, and return to (/practicetest)
    – 2567655222
    Aug 16 '18 at 14:31
  • and where you want to redirect after registration? Aug 16 '18 at 14:31
  • in above code, change ex: test.com/custom_page custom_page => ( with your current registration page slug ) also change this link 'customlink.com/asdasda' Aug 16 '18 at 14:33
  • updated above answer Aug 16 '18 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.