Navigation überspringen

[Closed] search number filter not working properly

This support ticket is created vor 3 years, 5 months. 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.

Dieses Thema enthält 1 reply, hat 2 Stimmen.

Zuletzt aktualisiert von Nigel vor 3 years, 5 months.

Author
Artikel
#2527991
2023-01-05_12-57-11.png
2023-01-05_12-57-21.png

when i type 999 it wont find the result
it requires to write exactly the correct number
see screenshot

#2528305

Nigel
Unterstützer

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: Europe/London (GMT+01:00)

That's correct. You are filtering a single numeric field; when a user provides a number to filter by, the query looks for posts with a field that has that same value.

For partial matches you would use a text search field (and to include custom fields rather than just the post title and content in the search fields you would need to add Relevanssi to your site).

One option, to continue using a filter for the numeric field specifically, would be to use the API filter wpv_filter_query to modify the query arguments, to change the comparison from '=' to 'LIKE' (and wrap the filter value in % so that the generated query looks something like 'meta_value' LIKE "%999%" in your example).

See
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters

The topic ‘[Closed] search number filter not working properly’ is closed to new replies.