Add custom required class to all required fields

add_filter( 'user_meta_field_config', 'user_meta_field_config_add_class', 10, 3 );
function user_meta_field_config_add_class( $field, $fieldID, $formName ){     
    if( !empty($field['required']) || in_array($field['field_type'], array('user_login', 'user_email')) ){
        $field['field_class'] = 'your_required_class '; // leave an empty space after classname
    }
 
    return $field;
}

Leave a Reply

Subscribe to our newsletter