Join

Unlock Custom Taxonomies Within MyListing Quick Search

Don't want to mess with guides or code snippets? This is a feature of MyListing Pro.

MyListing Quick Search only surfaces built-in taxonomies by default, so custom ones stay invisible even when they power your directory.

This guide not only shows you how to enable custom taxonomies in quick search, but it also lets you pick which custom taxonomies to include, and matching terms will appear in the instant results dropdown.

Implementation

  1. Add the code snippet below to your site, replacing the Custom Tax entries (e.g., Custom Tax 1, Custom Tax 2, etc.) with the actual names of your custom taxonomies
PHP
$GLOBALS['CUSTOM_TAX_FOR_QUICK_SEARCH']=["Custom Tax 1","Custom Tax 2","Custom Tax 3"];
  1. Copy the content of the code snippet below to your clipboard
PHP
if($GLOBALS['CUSTOM_TAX_FOR_QUICK_SEARCH']){
	foreach($GLOBALS['CUSTOM_TAX_FOR_QUICK_SEARCH'] as $tax){
		$sections[strtolower($tax)] = $this->get_terms( [
			'title' => _x( $tax, 'Quick search > '. $tax . ' section title', 'my-listing' ),
			'taxonomy' => strtolower($tax),
			'search_term' => $search_term,
		] );

	}
}
  1. Using an FTP application such as FileZilla (free), browse to the following location within the MyListing Parent Theme: /wp-content/themes/my-listing/includes/src/queries
  2. Copy the quick-search.php file to your local workstation and edit it with your preferred text editor
  3. Paste in the contents of the code snippet you just copied, placing it just above the line that reads if ( apply_filters( 'mylisting/quicksearch/show-regions', true ) ...
  4. Save
  5. Add the following folder structure to your MyListing Child Theme: /wp-content/themes/my-listing-child/includes/src/queries
  6. Copy the updated quick-search.php to the folder you created in the previous step
  7. Test

Note: For a custom taxonomy to appear in Quick Search, at least one Listing (published) must use that particular taxonomy.

Video Tutorial

Youtube video