stop redirection on /wp-login

I’ve installed a modified version of WordPress with “Duplicator” There is a problem loading the page I think it’s in the redirection How can I stop it? http://mysite/wp-login.php?redirect_to=http%3A%2F%2F45.63.40.242%2Fwp-admin%2Fadmin.php%3Fpage%3Dduplicator-tools%26tab%3Ddiagnostics%26section%3Dinfo%26package%3D20190714_d985d988d986d8b2d8a7_cccf8e77745a3e337539190714180116_archive.zip%26safe_mode%3D0

Frontend registration form doesn’t save data only redirects to wp-login

I have another wordpress dilemma… I’ve built a frontend registration form, but for some reason whenever a user tries to register it doesn’t work, and they get redirected to wp-login.php.

The following code does 5 things:

  1. gets user fields from a form (at the bottom),
  2. validates the data,
  3. inserts a new user into the database on success,
  4. logs the new guy in,
  5. sets the current_user to the new user

Here is the form / form head:

<?php $  err = ''; $  success = '';  global $  wpdb, $  PasswordHash, $  current_user, $  user_ID;   if(isset($  _POST['task']) && $  _POST['task'] == 'register' ) {   $  pwd1 = $  wpdb->escape(trim($  _POST['pwd1'])); $  pwd2 = $  wpdb->escape(trim($  _POST['pwd2'])); $  first_name = $  wpdb->escape(trim($  _POST['first_name'])); $  last_name = $  wpdb->escape(trim($  _POST['last_name'])); $  email = $  wpdb->escape(trim($  _POST['email'])); $  username = $  wpdb->escape(trim($  _POST['username']));  // if( false ) { if( $  email == "" || $  pwd1 == "" || $  pwd2 == "" || $  username == "" ) {     $  err .= "Please don't leave out any required fields.<br>"; }  if(!filter_var($  email, FILTER_VALIDATE_EMAIL)) {     $  err .= "Invalid email address.<br>"; }  if(email_exists($  email) ) {     $  err .= "Email already exist<br>."; }  if($  pwd1 <> $  pwd2 ){     $  err .= "Passwords do not match.<br>"; }  // if no error if ($  err == "") {     $  user_id = wp_insert_user(          array (             'first_name' => apply_filters('pre_user_first_name', $  first_name),             'last_name' => apply_filters('pre_user_last_name', $  last_name),             'user_pass' => apply_filters('pre_user_pass', $  pwd1),             'user_login' => apply_filters('pre_user_login', $  username),             'user_email' => apply_filters('pre_user_email', $  email),             'role' => 'subscriber'          )     );      if( is_wp_error($  user_id) ) {         $  err = 'Error on user creation.';     } else {          if(isset($  _REQUEST['redirurl'])) {             $  url = $  _REQUEST['redirurl']; // holds url for last page visited.         } else {             $  url = '/'; // default page for          }         header("Location:$  url");             do_action('user_register', $  user_id);          $  success = 'You\'ve successfully registered';          $  creds['user_login'] = $  username;         $  creds['user_password'] = $  pwd1;         $  creds['remember'] = true;         $  autologin_user = wp_signon($  creds, false); // automatically log the new user in          $  user = wp_set_current_user($  user_id); // set the current user to the user who just registered      }  }  } ?> <div class="alignleft"> <p>     <?php if($  sucess != "") { echo $  sucess; } ?> <?php if($  err != "") { echo $  err; } ?> </p> </div> <div class="<?php echo $  err ? '' : 'hidden animated fadeInDown duration2'; ?>" id="registrationForm"> <!-- Start form --> <form method="post" action="/login">     <?php var_dump($  _POST); ?>     <h1>Register</h1>     <h3>Account Detail</h3>     <!-- <input type="hidden" name="redirurl" value="<? echo $  _SERVER['HTTP_REFERER']; ?>" /> -->     <p>         <label>Username*</label>         <input type="text" value="" name="username" id="username" />     </p>     <p>         <label>Password*</label>         <input type="password" value="" name="pwd1" id="pwd1" />     </p>      <p>         <label>Confirm Password*</label>         <input type="password" value="" name="pwd2" id="pwd2" />     </p>      <h3>Contact</h3>     <p>         <label>Email*</label>         <input type="text" value="" name="email" id="email" />     </p>     <p>         <label>First Name</label>         <input type="text" value="" name="first_name" id="first_name" />     </p>     <p>         <label>Last Name</label>         <input type="text" value="" name="last_name" id="last_name" />     </p>                    <p>         <button type="submit" name="btnregister" class="button" >Submit</button>         <input type="hidden" name="task" value="register" />     </p> </form> </div><!-- end registration form --> 

And here is the snippet from the functions.php file that doesn’t let wordpress redirect to wp-login.php on login errors:

/** * Disable redirection upon login error */ function no_wordpress_errors(){   return header('Location: /login/?login=failed');   exit; } add_filter( 'login_errors', 'no_wordpress_errors' ); 

hint: there may be MANY things wrong with this code.

Thanks for your help!

Jill