0

I created a custom login form for a top menu, but I have problems with the redirect. Naturally WP redirect everyone to the Back-End, but I want to redirect everyone to the same site as they have been (just like a reload). I couldn't find anything about my problem, therfore I'm asking...

Function.php (Edit: This is now the fixed and working version)

function custom_login_form() {

    echo '<form name="loginform" id="loginform" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post">     

          <p class="login-submit">
              <a class="sidebarlogin_register" href="https://www.game-unity.com/wp-signup.php" rel="nofollow">' . __('Register', 'bresponZive') . '</a>         
          </p>

          <div class="login-inputs">
          <div class="login-button">
              <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="" tabindex="100" />
              <input type="hidden" name="redirect_to" value="' . site_url( $_SERVER['REQUEST_URI'] ) . '" />
              </div>
          <p class="login-username">
              <label for="user-login">
              <input type="text" name="log" id="user_login" class="input-text" value="" placeholder="' . __('Username', 'bresponZive') . '" size="20" tabindex="10" />
              </label>
          </p>  
          <p class="login-password">
              <label for="user-pass">
              <input type="password" name="pwd" id="user_pass" class="input-text" value="" placeholder="' . __('••••••••', 'bresponZive') . '" size="20" tabindex="20" />
              </label>
          </p>

          </div>
    </form>';
}

Note: (This is my try, but it doesn't seem to work)

<input type="hidden" name="redirect-to" value="' . site_url( $_SERVER['REQUEST_URI'] ) . '" />

The form in action: https://en.unicstack.com/data/geographic-id=11

  • 1
    try with the name redirect_to for the hidden field – mmm Feb 5 '17 at 18:48
  • Yeay, that was it :) – Game Unity Feb 5 '17 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.