I recently created a wordpress theme, and wanted to have my own login area on the main page. The code I'm using is below, but for some reason it doesn't quite work. It allows me to log in, but when I do I'm redirected to example.com/wordpress/wordpress/ instead of example.com/wordpress/ and I can't figure out where the extra subdirectory is coming from. The code 'works' because if I manually change the URL after getting 404'd I'm logged in, but I can't figure out why it's doing that in the first place.
<?php $args = array(
'echo' => false,
'redirect' => site_url( $_SERVER['REQUEST_URI'] ),
'form_id' => 'loginform',
'label_username' => __( 'Username' ),
'label_password' => __( 'Password' ),
'label_remember' => __( 'Remember Me' ),
'label_log_in' => __( 'Log In' ),
'id_username' => 'user_login',
'id_password' => 'user_pass',
'id_remember' => 'rememberme',
'id_submit' => 'wp-submit',
'remember' => true,
'value_username' => NULL,
'value_remember' => false
);
wp_login_form( $args );
echo '<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post">';
?>
<table>
<tr>
<td>Username</td>
<td>Password</td>
<td></td>
</tr>
<tr>
<td><?php echo '<input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="12" />'; ?></td>
<td><?php echo '<input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="12" />'; ?></td>
<td><?php echo '<input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" />
<input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" />'; ?></td>
</tr>
</table>
</form>