create custom registration form wordpress

escape(trim($_POST['password1'])); $password2 = $wpdb->escape(trim($_POST['password2'])); $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( $email == "" || $password1 == "" || $password2 == "" || $username == "" || $first_name == "" || $last_name == "") { $error= 'Please don\'t leave the required fields.'; } else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error= 'Invalid email address.'; } else if(email_exists($email) ) { $error= 'Email already exist.'; } else if($password1 <> $password2 ){ $error= 'Password do not match.'; } else { $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_user_pass', $password1), 'user_login' => apply_filters('pre_user_user_login', $username), 'user_email' => apply_filters('pre_user_user_email', $email), 'role' => 'subscriber' ) ); if( is_wp_error($user_id) ) { $error= 'Error on user creation.'; } else { do_action('user_register', $user_id); $success = 'You\'re successfully register'; } } } ?>
'.$err.''; endif; ?> '.$success.''; endif; ?>

Don't have an account?
Create one now.