Skip Navigation

[Resolved] Search multiple custom fields with one filter

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

Problem: I would like to use a text input field to search multiple custom field values.

Solution: Install the Relevanssi plugin to include custom field values in text searches.

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

This support ticket is created 6 years, 7 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by josueO 6 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#918012
Captura.PNG

good morning I am currently doing a project where I need to do a search but I do not repeat text fields, only use one to search in different fields. example attached image

attached fragment code that I want to make or concatenate the search variables

<div class="form-group">
<label>[wpml-string context="wpv-views"]Titulo[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-titulo-completo" url_param="wpv-wpcf-titulo-completo"]
</div>
<div class="form-group">
<label>[wpml-string context="wpv-views"]Resumen en Español[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-resumen-en-espanol" type="textfield" url_param="wpv-wpcf-resumen-en-espanol"]

#918044

I need to do a search but I do not repeat text fields
Hi, you can use the Text Search feature to search custom field values, as well as post title and content. You must install the Relevanssi plugin. We have a detailed guide here:
https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/

#918052
Captura.PNG

I would like to know if this can be done to generate searches

#918087

No, you cannot combine search filters and parameters in a single field like this.

If you want to use one text input filter to search in multiple custom fields, the Relevanssi integration I mentioned earlier is the best way to do this. If you are a PHP developer, you can also write custom code using the Views API wpv_filter_query to manipulate the WP_Query generated by the custom search View. We have documentation about this API here: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#919642

Excelente