• Hello, do filters/actions or a method exist [in TML] for the third step in the following scenario?

    1. User tries to access specific page, but I have function in theme that
    2. redirects them to TML login page.
    3. After logging in, user is redirected to the page they tried to initially access.

    Here is the code that blocks access to a specific page (if not logged in):

    add_action( 'template_redirect', function() {
    
        if ( is_user_logged_in() ) return;
    
        $restricted = array( 85 );
    
        if ( in_array( get_queried_object_id(), $restricted ) ) {
            wp_redirect( site_url( '/donate/login' ) ); 
            exit();
        }
    
    });

    The page /donate/login has the TML shortcode [theme-my-login show_gravatar="0" show_reg_link="0"]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    What is it that you are trying to achieve?

    Thread Starter habitcreature

    (@habitcreature)

    Hi Jeff,

    Thanks for responding!

    A custom function in functions.php has wp_redirect( site_url( '/donate/login' ) );..

    Should I append /?redirect_to=https://a.url.here? so that it’s wp_redirect( site_url( '/donate/login/?redirect_to=https://a.url.here' ) );

    or does tml have a hook for this in any way? New to programming!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Redirect after redirect’ is closed to new replies.