Title: Add filter
Last modified: February 13, 2019

---

# Add filter

 *  [AdSimple](https://wordpress.org/support/users/adsimple/)
 * (@adsimple)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/add-filter-2/)
 * Hi. Can you please update load_taxonomy_choices method in GFCPTAddonBase class.
   (
   i added filter in it)
 *     ```
       function load_taxonomy_choices($taxonomy, $type, $first_choice = '', $field ) {
       			$choices = array();
   
       			if ( in_array( $field->get_input_type(), gf_apply_filters( array( 'gfcpt_hierarchical_display', $field->formId, $field->fieldId ), array( 'select', 'multiselect' ) ) ) ) {
   
       				$terms = $this->load_taxonomy_hierarchical( $taxonomy, $field );
   
       				if( $field->get_input_type() == 'select' ) {
       					if ( $first_choice !== '' && $first_choice !== 'First Choice' && empty( $field->placeholder ) ) {
       						// if no default option is specified, dynamically create based on taxonomy name
       						$taxonomy = get_taxonomy($taxonomy);
       						$choices[] = array('text' => "-- select a {$taxonomy->labels->singular_name} --", 'value' => '');
       					}
       				}
   
       			} else {
       				$terms = get_terms($taxonomy, 'orderby=name&hide_empty=0');
       			}
   
       			if ( !array_key_exists("errors",$terms) ) {
       			  foreach($terms as $term) {
       				  $choices[] = array('value' => $term->term_id, 'text' => $term->name);
       			  }
       			}
   
       			return apply_filters( 'gfcptaddon_taxonomy_choices', $choices, $taxonomy, $type, $first_choice, $terms );
       		}
       ```
   
 * I updated return in it to:
 * `return apply_filters( 'gfcptaddon_taxonomy_choices', $choices, $taxonomy, $type,
   $first_choice, $terms );`
 * Thanks.
    -  This topic was modified 7 years, 3 months ago by [AdSimple](https://wordpress.org/support/users/adsimple/).

Viewing 1 replies (of 1 total)

 *  [Aaron Ware](https://wordpress.org/support/users/aware/)
 * (@aware)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/add-filter-2/#post-11270475)
 * This would be a great filter to add to the plugin or at least the ability to 
   filter the default choice

Viewing 1 replies (of 1 total)

The topic ‘Add filter’ is closed to new replies.

 * ![](https://ps.w.org/gravity-forms-custom-post-types/assets/icon-256x256.png?
   rev=2542252)
 * [Gravity Forms + Custom Post Types](https://wordpress.org/plugins/gravity-forms-custom-post-types/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-custom-post-types/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Aaron Ware](https://wordpress.org/support/users/aware/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/add-filter-2/#post-11270475)
 * Status: not resolved