Search Divi Ajax Search Documentation
Search for answers or browse our knowledge base.
How to exclude Taxonomies?
Now the ‘Exclude Taxonomies’ setting has been available in the module since version 1.0.5
To exclude specific taxonomies from the Divi Ajax Search module, you can follow these steps:
- Access your WordPress Dashboard.
- Navigate to “Appearance” and select “Theme File Editor”.
- Locate and open the functions.php file of your child theme. If it doesn’t exist, you may need to create one.
- Add the following code at the end of the functions.php file:
Copy code to make these changes, so your modifications are not lost during theme updates.
function wp_das_exclude_taxonomies($exclude)
{
return array( ‘product_cat’, ‘product_tag’ );
}
add_filter(‘das_exclude_taxonomies’,’wp_das_exclude_taxonomies’);
This code defines a custom function, wp_das_exclude_taxonomies, that returns an array of taxonomies to exclude from the search. In this example, ‘product_cat’ and ‘product_tag’ are excluded.
The add_filter function hooks this custom function into the ‘das_exclude_taxonomies’ filter, ensuring it is applied to the Divi Ajax Search module.
Save the changes to the functions.php file, and the specified tags and categories will be excluded from the search results in the Divi Ajax Search module.
Please note that modifying theme files directly is not recommended. It’s best practice to use a child theme.