This guide focuses on how to search posts only, while ensuring the search term matches taxonomy names (like categories or tags) and custom field values (like product codes or event dates).
⚙️ Step-by-Step Configuration
1. Filter Results to Posts Only
To ensure the search results include only posts:
- Open the Search Options tab in the Smart Search module.
- Under Post Types, select only
post
. - This filters out pages, products, or other custom post types.
🧠 Why it matters: Narrowing the scope to posts keeps results focused and relevant—especially useful for blogs, news sites, or content-heavy platforms.
2. Enable Taxonomy Term Search
To match search terms against taxonomy names (like category
, post_tag
, or custom taxonomies):
- In the Advanced Options tab, toggle Search in Taxonomy Terms to Enabled.
💡 Example: If a post is tagged with “Sustainability,” a search for “sustainability” will return that post—even if the word doesn’t appear in the title or content.
3. Enable Custom Field Value Search
To match search terms against custom field values:
- Go to the Advanced Options tab.
- Toggle Search in Custom Fields to Enabled.
- Enter the custom field keys you want to include (e.g.,
product_code
,event_date
,author_bio
).
🛠️ Tip: Use exact field keys as defined in ACF or your custom field plugin. You can include multiple keys for broader coverage.
🧪 Testing Your Setup
Once configured:
- Try searching for a term that exists only in a taxonomy name or custom field.
- Confirm that relevant posts appear—even if the term isn’t in the post title or body.
🔍 Example searches:
- “Eco-friendly” → returns posts tagged with
eco-friendly
. - “AB123” → returns posts with a matching
product_code
custom field.
🧭 Best Practices
- Use meaningful field keys: Avoid vague names like
field1
; useevent_location
orproduct_sku
for clarity. - Combine filters: You can layer taxonomy and custom field search with post type filtering for precision.
- Optimize performance: Searching across multiple fields can impact speed—test and refine as needed.
0 Comments