• Resolved alliedcreative

    (@alliedcreative)


    I’ve been having this issue for a few of the last versions now.

        User is not logged in.
        User visits a single post (custom post type called ‘documents’). Documents are only visible to logged in users.
        User is redirected to the login page, with ‘?redirect_to’ set in the URL parameter linking directly to the document.
        When the user enters their login info and clicks login, the page refreshes and they’re sent back to the login page again, thus an endless loop.
        The only way to fix this is to change the ‘redirect_to’ parameter to start with an ‘https://’, instead of ‘//’ like it is currently. Then it redirects to the correct page after login.

    The way I’ve managed to fix this is by implementing the following code in plugins/ultimate-member/includes/core/um-actions-login.php

    // Priority redirect

    if ( ! empty( $args[‘redirect_to’] ) ) {

    $redirect_to = $args[‘redirect_to’];

    if (substr( $redirect_to, 0, 2 ) === “//”) {
    $redirect_to = str_replace(‘//’, ‘https://’, $redirect_to);
    }

    exit( wp_safe_redirect( $redirect_to ) );
    }

    Any way to fix this without editing plugin code?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Endless redirect when redirect_to is set during login’ is closed to new replies.