Skip Navigation

[Resolved] How to include taxonomy terms in custom searches?

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to include taxonomy terms in custom searches?

Solution:
Searches normally only search the post title and optionally post content. To include taxonomies (or custom fields) you can use the Relevanssi plugin.

Relevant Documentation:
https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by tomS-10 6 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#902437

I have made a search function with views, but when people search, the criteria must match with the title. How can I make sure that when a user search, it can also match with the content and taxonomies?

I have made a filter-control for taxonomies, but it`s does not work so well since then the user needs to find the specific category.

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
	[wpv-control-post-taxonomy taxonomy="category" type="select" default_label="Kategori" url_param="wpv-category"]
	[wpv-filter-search-box placeholder="Søk her" output="bootstrap" class="btn-large"]
  	[wpv-filter-submit name="Søk" output="bootstrap" class="btn-large"]
  [wpv-sort-orderby type="select" options="post_date,post_title,field-wpcf-view-count" label_for_post_date="Dato" label_for_post_title="Tittel" label_for_field-wpcf-view-count="Mest lest" orderby_as_numeric_for="field-wpcf-view-count" orderby_ascending_for="post_title" orderby_descending_for="post_date,field-wpcf-view-count"]
</div>
[wpv-filter-end]

Looking for a solution,

#902455

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Tom

The Views search (rather than filtering) uses the built-in WordPress search functionality, which only searches titles and, optionally, the post body.

You can use Relevanssi to also include taxonomies in the search. The expected use case in our documentation is to use it to include custom fields in searches, but it also works with taxonomies.

See https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/

#902759

Great, thank you. I had troubles finding out where "Custom fields" was, but that`s not your fault.