• Resolved doyenwilliams

    (@doyenwilliams)


    I’m using the shortcode to redirect my users after they login a la

    [user_registration_my_account redirect_url="sample-page"]

    …however I would like to pass variables to that URL like this:

    [user_registration_my_account redirect_url="sample-page/?adynamicusername"]

    Is this possible?

    • This topic was modified 4 years, 11 months ago by doyenwilliams.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter doyenwilliams

    (@doyenwilliams)

    Hey there,

    In an attempt to find a workaround I followed the instructions here:

    https://docs.wpeverest.com/docs/user-registration/how-to/how-to-change-redirect-url-after-login/

    …but instead of including the code in my active theme’s functions.php I made a custom plugin container and added it that way. However, the redirect is NOT WORKING.

    Has the code to use been updated from what is on that page? (shown below)

    add_filter( ‘user_registration_login_redirect’, ‘ur_redirect_after_login’, 10, 2 );
    function ur_redirect_after_login( $redirect, $user ) {
    return ‘sample-page’ ;
    }
    Thread Starter doyenwilliams

    (@doyenwilliams)

    Resolved.

    Of note – using the redirect_url on both the user_registrtation_login and user_registration_my_account shortcodes causes the pages to automatically redirect to the specified address on EVERY LOAD of the page where either shortcode exists once the user is currently logged in.

    Using the code above will only work on the FIRST LOAD of the page when the login is executed. Every consequent load will produce a message to user advising of their logged in status.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add username to redirect URL after login’ is closed to new replies.