How do I register user without being authenticated

Question

I get form data through ajax and I want to use it and add a new user with a subscriber role. to the original WordPress users and also send them a notification about their account.
Here is the bit of code that I have so far.

function set_form()
{
    $fisrt_name = $_POST['fisrt_name'];
    $email = $_POST['email'];
    $email = $_POST['email'];
    $admin =get_option('admin_email');
    //Code to register user

    die();
}
add_action('wp_ajax_set_form', 'set_form');    //execute when wp logged in
add_action('wp_ajax_nopriv_set_form', 'set_form'); //execute when logged out
0
, , novapack 10 months 2020-05-10T03:10:18-05:00 0 Answers 93 views 0

Leave an answer