Skip Navigation

[Resolved] Exact search matching

This support ticket is created 6 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 6 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#958271

Pat

Hello,

I'm coming back to an old ticket : https://toolset.com/forums/topic/search-on-term-field/

Some users have made some remarks that the Views gives a result even if the entire text is not reflecting one of the post titles (for example, if you enter an single letter, the first post with a title having this letter will be displayed).

Is there a way to enforce the code in order to ensure only exact matches will be displayed?

Regards
Pat

#958686

Dear Pat,

There isn't such a built-in feature within Views plugin, you might need to consider custom codes, for example, use filter hook wpv_filter_query to trigger a PHP function
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

In this PHP function to setup the query as "Exact search matching", see similar thread:
https://wordpress.stackexchange.com/questions/177183/make-a-wp-query-search-match-exactly-the-search-term