# I would like to remove the 'name' field from the form editor

**URL:** <https://community.gravityforms.com/t/i-would-like-to-remove-the-name-field-from-the-form-editor/16077>\
**Category:** Get Help\
**Tags:** custom, gform\_add\_field\_buttons, gform\_field\_groups\_form\_editor\
**Created:** [October 23, 2023, 9:21am UTC](https://community.gravityforms.com/t/i-would-like-to-remove-the-name-field-from-the-form-editor/16077 "2023-10-23T09:21:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![studioalloy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/studioalloy/32/2446_2.png) [@studioalloy](https://community.gravityforms.com/u/studioalloy)\
**Post date:** [October 23, 2023, 9:21am UTC](https://community.gravityforms.com/t/i-would-like-to-remove-the-name-field-from-the-form-editor/16077/1 "2023-10-23T09:21:57Z")

</div>

I have the following function, but this will just move the ‘name’ field to the 'standard\_fields` group. Am I missing something or is this a bug?

As you can see in the screenshot the “Naam” field (“Name” in English) has moved the the field group above it (Standard fields)

 ![Screenshot 2023-10-23 at 11.16.14](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/0/06be566440e15e3435a9d41a428f0b646b616b3b.jpeg)

```auto
function disable_name_advanced_field_type($field_groups)
{

    // Loop through field groups
    foreach ($field_groups as &$group) {
        if ($group['name'] === 'advanced_fields') {
            // Loop through fields in the "advanced_fields" group
            foreach ($group['fields'] as $key => $field) {
                // Check for the "name" field and remove it
                if ($field['data-type'] === 'name') {
                    unset($group['fields'][$key]);
                }
            }
        }
    }
    return $field_groups;
}
add_filter('gform_field_groups_form_editor', 'disable_name_advanced_field_type');

```

What I would think what would happen running this function is that it gets unset from the `advanced_fields` and with it removed from the list.

I’ve also tried creating the same function twice and changing `if ($group['name'] === 'advanced_fields') {` to `if ($group['name'] === 'standard_fields') {`, but this does nothing.

---

<div class="post-metadata">

**Author:** ![uamv](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/uamv/32/1412_2.png) [@uamv](https://community.gravityforms.com/u/uamv)\
**Post date:** [October 30, 2023, 8:42pm UTC](https://community.gravityforms.com/t/i-would-like-to-remove-the-name-field-from-the-form-editor/16077/2 "2023-10-30T20:42:43Z")

</div>

The following will work for this purpose…

```auto
// remove Name field type from editor
add_filter( 'gform_add_field_buttons', function( $field_buttons ) {

    foreach( $field_buttons as &$field_group ) {
        
        if ( is_array( $field_group ) && array_key_exists( 'fields', $field_group ) ) {
            
            $field_group['fields'] = array_filter( $field_group['fields'], function( $field ) {
                return ! in_array( $field['data-type'], ['name'] );
            } );

        }

    }

    return $field_buttons;

} );

```

Any other field types you might like to remove can be added as an item to the array within the `array_filter` function.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [November 29, 2023, 8:43pm UTC](https://community.gravityforms.com/t/i-would-like-to-remove-the-name-field-from-the-form-editor/16077/3 "2023-11-29T20:43:33Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
