Skip to content


How-to Guides

Technical References

VIP Search /

Identify which post taxonomies are indexed

⚠️ VIP Search is in limited beta

This documentation is subject to change. Features described here may not be available, may not be fully functional, or may change without notice, prior to general availability.

This is the second step in the audit we discussing in the introduction: post taxonomies.

Taxonomies must be indexed to be used in queries

Our example custom post type of event has at least two terms for the event-format taxonomy: virtual, and in_person

We have a search that includes a taxonomy query in the arguments:

	'tax_query' => array(
			'taxonomy' => 'event-format',
			'field'    => 'slug',
			'terms'    => $format

It’s the $format variable (coming from the search form or a query parameter) that indicates whether the user is looking for virtual, in_person, possibly both (in an array), or a future format that hasn’t been implemented yet.

Adding post taxonomies to an allow list

So the actual taxonomy we need to index here is event-format – I’ve also included event-city here as an additional example; often multiple taxonomies will be declared in the same filter.

These taxonomies are only being indexed when the custom post type is event.

add_filter( 'vip_search_post_taxonomies_allow_list', 'mysite_events_indexable_post_tax', 10, 2 );

function mysite_events_indexable_post_tax( $allow, $post ) {
	if ( is_object( $post ) && 'event' === $post->post_type ) {
		$allow[] = 'event-format';
		$allow[] = 'event-city';

	return $allow;

Note the convention above builds a list that looks as follows; it’s an indexed array.


Last updated: April 09, 2021