Opened 7 weeks ago
Last modified 7 weeks ago
#61746 new defect (bug)
WordPress login redirect issue
Reported by: | dipakparmar2007 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | critical | Version: | 6.6.1 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
if ( isset( $_POSTaction? ) && $_POSTaction? == 'log-in' ) {
$user_login = $_POSTuser_login?;
$password = $_POSTpassword?;
$user_data = array(
'user_login' => $user_login,
'user_password' => $password,
'remember' => true
);
$user = wp_signon( $user_data );
if ( ! is_wp_error( $user ) ) {
$user_id = $user->ID;
if ( $user_id ) {
$url = site_url().'/dashboard/';
wp_redirect( $url );
exit;
}
} else {
$error_message = $user->get_error_message();
}
}
<form action="" method="post" class="sign-in">
<div class="form_group">
<label for="user_login"><?php _e('Username'); ?></label>
<input type="text" name="user_login" class="input_control" id="user_login" value="" />
</div>
<div class="form_group">
<label for="password"><?php _e('Password'); ?></label>
<input type="password" class="input_control" name="password" id="password" />
</div>
<div class="forgot"><a href="<?php echo site_url(); ?>/forgot-password/">Forgot Password?</a></div>
<div class="form_footer">
<button type="submit"><?php _e('Log in'); ?></button>
<input type="hidden" name="action" value="log-in" />
</div>
</form>
This hook is ilso not work in WordPress version 6.1.1 and I set default themes.