I’m unable to understand how $_REQUEST[‘redirect_to’] works. From where does this get value of ‘redirect_to’?

 public function render_login_form( $attributes, $content = null ) {
    // Parse shortcode attributes
    $default_attributes = array( 'show_title' => false );
    $attributes = shortcode_atts( $default_attributes, $attributes );
    $show_title = $attributes['show_title'];

    if ( is_user_logged_in() ) {
        return __( 'You are already signed in.', 'personalize-login' );
    }

    // Pass the redirect parameter to the WordPress login functionality: by default,
    // don't specify a redirect, but if a valid redirect URL has been passed as
    // request parameter, use it.
    $attributes['redirect'] = '';
    if ( isset( $_REQUEST['redirect_to'] ) ) {
        $attributes['redirect'] = wp_validate_redirect( $_REQUEST['redirect_to'], $attributes['redirect'] );
    }

    // Render the login form using an external template
    return $this->get_template_html( 'login_form', $attributes );

Read more here: What does $_REQUEST[‘redirect_to’] do?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: