Recently I’ve built a user directory on our project and we built a search filter to search user’s name with Cwicly’s frontend render query.
Current this search only works when we search the exact username, for example, I have a user called
‘Example’, I can only find this user by search ‘Example’. When I try to search with ‘Ex’ or 'Exam, nothing will return.
Is there a documentation or a way for us to change the search behavior so it can be more sensitive? Like any way we can manipulate it with PHP?
@T-low Yea so the way we build our user object is to avoid showing those personal information you mentioned, so we are good in terms of security issue.
Looking for a solution here to enhance the search filter input so it can search by case-sensitive.
It doesn’t use a filter but it can all be created and styled with Cwicly.
Please see this thread for details:
From reading your post again, I can see you are already using a filter with front-end rendering so this method would require a change of approach, so may not be the perfect fit in this case.
So if anyone come across this issue as I did, then here is my solution:
Create an ACF field for user meta, and write a function in PHP to fetch your user’s display name (or whatever you wish to use for the search) and put it in the user meta you created automatically, then use the Meta Query for the search filter, then the search input will work like a champ as it will search anything that contains in your keyword.