wp_insert_user function not adding password field to database

You don’t need to call ‘pre_user_*’ filters, that are called by WordPress inside wp_insert_user. Also I suggest to use php filter_input or filter_input_array to sanitize form input. Example code: $args = array( ‘pwd1’ => FILTER_SANITIZE_STRING, ‘pwd2’ => FILTER_SANITIZE_STRING, ‘first_name’ => FILTER_SANITIZE_STRING, ‘last_name’ => FILTER_SANITIZE_STRING, ‘username’ => FILTER_SANITIZE_STRING, ’email’ => FILTER_SANITIZE_STRING ); $form_data = filter_input_array( INPUT_POST, … Read more

Custom registration fields not validating

the value of the checkbox wouldn’t be “checked” – it should equal whatever you put in the “value” attribute .. and i think you need an extra set of parentheses in the if statement for first_name to make sure your filter is firing you could try explicitly adding an error (with no validation checks) to … Read more

register_settings callback function erases data

in case of wrong value, the function has to return the original value then try this : function email_validation($data, $option, $original_value) { if (null == $data) { add_settings_error( ‘requiredTextFieldEmpty’, ’empty’, ‘Notification Email cannot be empty’, ‘error’ ); return $original_value; } else { if (!is_email($data)){ add_settings_error( ‘requiredTextFieldEmpty’, ’empty’, ‘Notification Email is not valid email address’, ‘error’ … Read more

wp_insert_user not returning anything

I found out what it was. I had an action hook for user_register on my functions.php. This action hook would automatically login the user after registration. After removing it, it worked. As requested, the hook was interfearing because I was already logged in. The hook would use wp_set_current_user($user_id); wp_set_auth_cookie($user_id); to log in after registration.

Disable password limitations

if you use wocommerce please try this code to your current theme functions.php add_action( ‘wp_enqueue_scripts’, ‘misha_deactivate_pass_strength_meter’, 10 ); function misha_deactivate_pass_strength_meter() { wp_dequeue_script( ‘wc-password-strength-meter’ ); }