title: Wordpress - Displaying login form in shortcode
body: <p>I tried the wordpress stack but no luck so thought I'd try here...</p>
  
  <p>So I am trying to display a working version of the default wordpress login form on one of my pages. There is code in the functions.php file that creates the shortcode and as far as I know it works successfully, however after submitting the form, it simply refreshes the page and doesn't redirect to the url I am specifying...can anyone see why it might not work as it should?</p>
  
  <p>This is the function I put in the functions.php file:</p>
  
  <pre><code>//Login form Shortcode
  add_shortcode( 'login-form', 'my_login_form_shortcode' );
  /**
   * Displays a login form.
   *
   * @since 0.1.0
   * @uses wp_login_form() Displays the login form.
   */
  function my_login_form_shortcode( $atts, $content = null ) {
  
      $defaults = array(      "redirect"              =&gt;  site_url( $_SERVER['REQUEST_URI'] )
                          );
  
          extract(shortcode_atts($defaults, $atts));
          if (!is_user_logged_in()) {
          $content = wp_login_form( array( 'echo' =&gt; false, 'redirect' =&gt; $redirect ) );
          }
      return $content;
  }
  </code></pre>
  
  <p>I am then placing it in the desired page like so:</p>
  
  <pre><code>[login-form redirect="https://myurl.com"]
  </code></pre>
  
  <p>but instead of redirecting me to the right page, it is instead refreshing the page even though I am now successfully logged in...any ideas?</p>