Allows users to modify which field is used when looking up terms via get_term_by(). Defaults to name, but can be any of: ‘slug’, ‘name’, ‘term_id’ (or ‘id’, ‘ID’), or ‘term_taxonomy_id’


The following would apply to all forms:

add_filter( 'gform_advancedpostcreation_taxonomy_mapping_field', 'your_function_name', 10, 3 );


  • $field string
    Current form field that is being processed for mapping
  • $taxonomy string
    Taxonomy currently being mapped to, ie category
  • $values array
    Array of the values to be mapped to the current Taxonomy. These represent the submitted field values.


Assign Taxonomy based on Term ID

Use the term_id instead of name to assign the taxonomy.

// Use term_id instead of name to assign the taxonomy
add_filter( 'gform_advancedpostcreation_taxonomy_mapping_field', function( $field, $taxonomy ) {
	return 'term_id'; // can also use 'id' or 'ID'
}, 10, 2 );

Assign Taxonomy based on Slug

Use the slug instead of name to assign the taxonomy.

// Use slug instead of name for assigning the taxonomy
add_filter( 'gform_advancedpostcreation_taxonomy_mapping_field', function( $field, $taxonomy ) {
	return 'slug';
}, 10, 2 );

The filter also passes through the $taxonomy being checked against, so you could conditionally choose which field to use for mapping based on that.

add_filter( 'gform_advancedpostcreation_taxonomy_mapping_field', function( $field, $taxonomy ) {
        if ( $taxonomy !== 'category' ) {
            return $field;
	return 'term_id';
}, 10, 2 );


This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?


This filter was added in the Gravity Forms Advanced Post Creation add-on version 1.3.

Source Code

This filter is located in GF_AdvancedPost_Creation::get_taxonomy_mapping_term_ids in class-gf-advancedpostcreation.php.