# Bug with gform\_field\_map\_choices filter

**URL:** <https://community.gravityforms.com/t/bug-with-gform-field-map-choices-filter/15035>\
**Category:** Get Help\
**Tags:** bug, gform\_field\_map\_choices\
**Created:** [April 27, 2023, 9:47pm UTC](https://community.gravityforms.com/t/bug-with-gform-field-map-choices-filter/15035 "2023-04-27T21:47:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![miguel.estrada](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/miguel.estrada/32/6999_2.png) [@miguel.estrada](https://community.gravityforms.com/u/miguel.estrada)\
**Post date:** [April 27, 2023, 9:47pm UTC](https://community.gravityforms.com/t/bug-with-gform-field-map-choices-filter/15035/1 "2023-04-27T21:47:53Z")

</div>

Hi I work with clients that use the GF plugin (and have registered keys) and while doing some custom implementation I ran into what seems like a bug with the `gform_field_map_choices` filter.  
The field used to target one individual choice at a time in a loop but now it targets all of them.  
I believe the filter used to be inside the loop while checking and adding each choice inside the method `Generic_Map::get_value_choices()` in the file `./includes/settings/fields/class-generic-map.php` and the `$input_type` could be checked property.  
But now the` $input_value` parameter is the value of the last looped field but for ALL calls of the filter.  
The Doc block for the filter is also inconsistent with the actual parameters passed to the filter.

Again, not sure if this is a bug or maybe an extra filter for singular `gform_field_map_choice` needs to be added?

The below check for `$input_type` is always be the type of the last field in the form.

```php
<?php
add_filter( 'gform_field_map_choices', function( $choices, $form_id, $input_type ) {
	if ( $input_type === 'field_type_to_check' ) {
		// cannot do things correctly since the $input_value is always the same, always the type of the last field in the form.
	}

	return $choices;
}, 10, 3 );

```

---

<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:** [May 27, 2023, 9:48pm UTC](https://community.gravityforms.com/t/bug-with-gform-field-map-choices-filter/15035/2 "2023-05-27T21:48:17Z")

</div>

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