Home Forums Backend Issues (wp-admin) Fields not saved properly with wp_insert_user


Fields not saved properly with wp_insert_user

  • I’ve made a custom user signup form that creates a wp user with wp_insert_user.

    Here’s what I have in my functions file:

    	$userdata = array(
    	    'first_name'	=> $_POST['userName'],
    	    'user_login'        => $user_name,
    	    'user_pass'		=> $random_password,
    	    'user_email' 	=> $user_email,
    	    'role'		=> 'event_participant'
    	$user_id = wp_insert_user( $userdata );
    	if( !is_wp_error($user_id) ) {
    			update_field('wpu_vat', $_POST['userVAT'], 'user_'.$user_id);
    			update_field('wpu_company_name', $_POST['userCompany'], 'user_'.$user_id);
    			update_field('wpu_title', $_POST['userTitle'], 'user_'.$user_id);
    			update_field('wpu_phone', $_POST['userPhone'], 'user_'.$user_id);
    } else...

    The values are inserted correctly but won’t show in the frontend unless I click the save button on the user page in wp. What’s going on here? Do I call the wp save user function after updating acf’s?

Viewing 1 post (of 1 total)

The topic ‘Fields not saved properly with wp_insert_user’ is closed to new replies.