Saltar navegación

[Cerrado] search number filter not working properly

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

Este tema contiene 1 respuesta, tiene 2 mensajes.

Última actualización por Nigel 3 years, 5 months ago.

Autor
Mensajes
#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
Colaborador

Idiomas: Inglés (English ) Español (Español )

Zona horaria: 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

El debate ‘[Cerrado] search number filter not working properly’ está cerrado y no admite más respuestas.