Problem:
I'm building a "parts" website. The client wants users to be able to search for parts, with or without using special characters, such as "-" or "/".
For instance, a customer should be able to search for "4-24864-0180" or "4248640180", and get the same results.
Solution:
If you are going to achieve what you want with wordpress built-in search form + Relevanssi plugin, it is out the range of Toolset support range, I suggest you contact with Relevanssi supporters.
If you are using Views to setup the custom search form, then it is possible with some custom codes, you can try with Views filter hook wpv_filter_query, for example:
when your user submit the search string "4-24864-0180", you can use filter hook wpv_filter_query to trigger a custom PHP function, in this function get the value of search string, turn it to be the value without dash "-": 4248640180
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
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 2 replies, has 2 voices.
Last updated by 7 years, 2 months ago.
Assisted by: Luo Yang.