Relevanssi Premium 2.4.4 introduced a new feature where you can target specific parts of the post straight from the search terms. The format for this is
Target can be one of the following:
- title: Post title.
- content: Post content.
- author: Author display name.
- comment: Comment text.
- link: Link from another post.
- excerpt: Post excerpt.
- taxonomy slug: Taxonomy name (use
categoryfor categories and the taxonomy slug for other taxonomies).
- custom field name: Custom field name.
- MySQL column name: Name of a custom MySQL column.
These are all compared against Relevanssi index, so you can use any of these targets only if Relevanssi indexes that particular type of content: if you want to, say, target excerpts, you need to make sure Relevanssi is set to index the excerpt.
The search term must be a single word, so if you want to target multiple words, use a specifier for each word separately. Phrases are not supported at the moment.
Search for word “cat” in titles only:
Search for word “dog”, but only in tags:
Search for posts that have the word “knizia” in taxonomy “designers” and the word “dutrait” in the taxonomy “illustrators”:
Note that for multiple targeted terms, you need to have a space between the terms.