Support Forum
Support › MB User Profile › required fields › Reply To: required fields
Ah, if you want to keep the email
field, then in the 2nd snippet, it's available in the $data
, so you should keep it (e.g. don't assign it to a completely new array).
The 2nd snippet should be:
add_filter( 'rwmb_profile_insert_user_data', function ( $data, $config ) {
// User strpos because the $config also contains default register form.
if ( false === strpos( $config['id'], 'user-account' ) ) {
return $data;
}
// Custom data for user.
$data['user_login'] = 'my_user3';
$data['user_pass'] = 'my_user_pass';
return $data;
}, 10, 2 );