The Divi Search Helper provides incredible search result options and keyword criteria settings, which you can configure to search exactly what you want on your site. In this guide, we will explore the search options for custom post types and taxonomies, as well as criteria such as title, context, excerpt and custom fields.
To configure your search results criteria, open the Divi Search module settings to the Content tab and open the Search Criteria toggle. Here you can adjust any setting according to your needs.
Search For Post Types And Taxonomies
Include Or Exclude Search Results Criteria
We introduced this feature in version 2.1, which allows you to choose whether the post type and taxonomy checkboxes should “include” or “exclude” the selected items. Until this dropdown was added, the only option was to “include” the selected items. However, some users faced scenarios where they wanted to include all options except a few specific items. Now, you can change a dropdown setting that determines whether the post type and taxonomy checkboxes will “include” or “exclude” the selected items.
Included/Excluded Post Types
All post types on your website will appear as checkboxes. This allows you to customize which post types are included or excluded in the search results based on the dropdown setting above.
Include Mode: If the dropdown is set to “include,” all post types will be included in the search results by default unless one or more checkboxes are selected. When one or more checkboxes are selected, only those selected post types will be included in the search results.
Exclude Mode: If the dropdown is set to “exclude,” all post types will be excluded in the search results by default unless one or more checkboxes are selected. When one or more checkboxes are selected, only those selected post types will be excluded from the search results.
Included/Excluded Taxonomy Terms
All taxonomies associated with the post types on your website will appear as groups of checkboxes. For example, there will be a section with all Post Categories and a list of checkboxes for each category name. Similarly, there will be sections for Post Tags, Project Categories, etc.
Each taxonomy section includes a list of checkboxes that allow you to customize which taxonomy terms are included or excluded in the search results based on the dropdown setting above.
Include Mode: If the dropdown is set to “include,” all taxonomy terms will be included in the search results by default unless one or more checkboxes are selected. When one or more checkboxes are selected, only those selected taxonomy terms will be included in the search results.
Exclude Mode: If the dropdown is set to “exclude,” all taxonomy terms will be excluded in the search results by default unless one or more checkboxes are selected. When one or more checkboxes are selected, only those selected taxonomy terms will be excluded from the search results.
Search For Title, Excerpt, And/Or Content
Search Keyword Criteria
Next we offer checkboxes for you to choose which parts of the post you want to include in the search criteria. You can choose to search the post title text, the post excerpt text, the entire post content text, or even the taxonomy term like the category name. You can include specific criteria or all of them accordion to your needs.
Search For Custom Meta Terms
Meta keys, also referred to as custom fields, are additional attributes associated with posts, pages, or other content on your website. They store specific details beyond standard content, such as product SKUs in eCommerce or custom fields from plugins like Advanced Custom Fields (ACF). Adding meta keys allows you to enhance search capabilities by including these details in search results, making it easier to find relevant content based on specific criteria.
How to Add Custom Meta Keys:
To include custom meta fields in your search results using the Divi Search Helper plugin, you can enter the relevant meta keys into the Custom Meta Key field, separated by commas. This method allows you to include a wide variety of meta data in the search results, such as WooCommerce product SKUs, custom fields from Advanced Custom Fields (ACF), categories, tags, and more.
General Steps:
- Identify the Meta Key: Determine the meta key for the specific data you want to include in the search. This could be a custom field, taxonomy (like a category or tag), WooCommerce SKU, or any other meta data associated with your posts or products.
- Enter the Meta Key: Once you’ve identified the meta key, enter it into the Custom Meta Key field within the Divi Search Helper plugin settings. Separate multiple meta keys with commas.
- Search Functionality: When a user searches for a keyword that matches the content of any of the included meta keys, the relevant posts or products will appear in the search results.
Examples:
Custom Fields:
- Scenario: You have a custom field for Dog Breed with the meta key
dog_breed
. - How to Add: Enter
dog_breed
into the Custom Meta Key field. - Result: When a user searches for a breed like “Labrador,” posts associated with that breed will show up in the search results.
WooCommerce SKU:
- Scenario: You want to include product SKUs in the search results, and WooCommerce typically uses the meta key
_sku
for this. - How to Add: Enter
_sku
into the Custom Meta Key field. - Result: If a user searches for a specific SKU, the corresponding product will appear in the search results.
Tags and Categories:
- Scenario: You want to include tags or categories in the search. Tags might use a meta key like
post_tag
, while categories might usecategory
. - How to Add: Enter
post_tag
andcategory
into the Custom Meta Key field. - Result: Searching for a tag or category name will return posts associated with that tag or category.
Advanced Custom Fields (ACF):
- Scenario: You’ve created custom fields using ACF, such as an image field with the meta key
image_1
. - How to Add: Enter
image_1
into the Custom Meta Key field. - Result: If the custom field content matches the search term, the post will be included in the search results.
By adding the appropriate meta keys, you can ensure that your search functionality is robust, providing users with relevant results based on various types of meta data.