Black Friday Super Sale 2024 Starts in

0Days

0Hours

0Minutes

0Seconds

WIN AN iPAD, LIFETIME MEMBERSHIP
×

Search Divi Ajax Search Documentation

Search for answers or browse our knowledge base.

< All Topics
Print

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:

  1. Access your WordPress Dashboard.
  2. Navigate to “Appearance” and select “Theme File Editor”.
  3. Locate and open the functions.php file of your child theme. If it doesn’t exist, you may need to create one.
  4. 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.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents