wordpress new user registration code example
Example: wordpress register user php
<php
$user = (isset($_POST['username']) ? $_POST['username'] : '');
$pass = (isset($_POST['password']) ? $_POST['password'] : '');
$email = (isset($_POST['email']) ? $_POST['email'] : '');
if (!username_exists($user) && !email_exists($email)) {
$user_id = wp_create_user($user, $pass, $email);
if (!is_wp_error($user_id)) {
$user = new WP_User($user_id);
$user->set_role('do');
wp_redirect('URL_where_you_want_redirect');
exit;
} else {
}
}else{
}
?>