Passer la navigation

[Résolu] Toolset view – Add ACF custom fields to parametric search

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
The issue here is that the user wanted to include ACF fields in the Toolset Views search however when they performed the search the view doesn't return any values.

Solution:
In order to perform a partial text search on any custom field with our Views/Blocks plugin you will need to have the relevanssi plugin installed.

It is only with this plugin installed that you are able to use the text search option to search through custom fields.

This support ticket is created Il y a 4 années. 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Fuseau horaire du supporter : America/Jamaica (GMT-05:00)

Ce sujet contient 6 réponses, a 2 voix.

Dernière mise à jour par Paul Marconi Il y a 4 années.

Assisté par: Shane.

Auteur
Publications
#2113421

Hi there,

I would like to add ACF custom fields to parametric search, but it's not working.
I have a Custom Post Type called 'Resources' and it contains 2 ACF custom fields (both text fields). One is for the author's name and one is for the year. (screenshot: lien caché)
I have created 2 Resources posts for testing (Example screenshot : lien caché).
I have also created a View. I know the default 'Text search' is for searching keywords in post titles and post content, but for now I am not using it. Instead, I have added a ACF custom field (author's name) as a 'text field' filter under the 'Search and Pagination' section (screenshot: lien caché).
When I went to check the functionality on this page (lien caché), and typed in a name (either John or Jane), it's not working. It's displaying 'No items found'.
However, when I switched the ACF custom field (author's name) to a different field type such as a select dropdown or checkboxes, it works. Why doesn't a text field work for ACF custom fields in the parametric search. Am I missing something?

Thank you!

#2113665

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Paul,

In order to get this accurately, you are referring to a textbox field and not a WYSIWYG field correct?

As I know WYSIWYG field might have special formatting that could affect this.

I would like to replicate this issue on my end but I need to know the exact field type.

Thanks,
Shane

#2114275

Hi Shane,

Yes, it's a textbox field, not a WYSIWYG field (screenshot: lien caché).
(lien caché)

Thanks!

#2114369

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Paul,

I tested this on my end and it works without any issues at all.

What I did notice is that the search field text must match exactly what is in the custom field or it won't work. Perhaps it may be better to use Relevanssi and add the general search to the view as this will allow you to search through custom fields as well and as long as the text partially matches it will work.

Thanks,
Shane

#2114445

Thanks Shane for investigating this!

That's strange. Are my Toolset View settings correct?

Under 'Query Filter' section, I have:
Select items with field: Filter based on the frontend search filter by resource_author_name. (screenshot: lien caché)

Under 'Search and Pagination' section, I have this (screenshot lien caché)
As well, the settings for the custom textbox field (filter) is this (screenshot: lien caché)

Under 'Loop Editor ' section, I have this (screenshot: lien caché)

Are those correct?

Thank you!

#2114471

Hi Shane,

Yes, I get your point now. The search field text must match exactly what is in the custom field. If the custom field has the value 'John Doe', users will have to input 'John Doe' and not just partial of the name in the search field.

My issue is resolved now.

Thanks!

#2114473

My issue is resolved now. Thank you!