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 );

Here, $_REQUEST['redirect_to'] is default parameter available in WordPress to redirect once you login correctly while sign in or sign up. e.g. User Dashboard. Ref : https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect

In General redirect_to will redirect user to user dashboard or same page if any credential or details false.

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.