Skip Navigation

[Resolved] How can I limit Custom Search result to EXACT MATCH of the custom post title?

This thread is resolved. Here is a description of the problem and solution.

Problem:
How can I limit Custom Search result to EXACT MATCH of the custom post title?

Solution:
To search by exact title you need to override the query arguments yo u need to use the WordPress 'posts_search' hook.

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/how-can-i-limit-custom-search-result-to-exact-match-of-the-custom-post-title/#post-921659

Relevant Documentation:

This support ticket is created 6 years, 4 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 18 replies, has 2 voices.

Last updated by PaulS4783 6 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#921703

Try this link.
hidden link
Is it relevant that the search results output is on a different page?

#921704

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You should have mentioned that first. YES - thats why the problem occurs.

Please try following code:

[wpv-conditional if="( '[wpv-search-term param='wpv_post_search']' eq '' ) AND ( '[wpv-search-term param='wpv_filter_submit']' ne '' )"]
 [wpml-string context="wpv-views"]You must enter a search code.[/wpml-string]
[/wpv-conditional]

Now - it must be FIXED 🙂 - waiting for your confirmation 🙂

#921706

Bingo!
Fantastic work.

Thanks for all your support on this.
I don't think I would have solved it alone.

You can close the ticket. 😉

#948973
shot3.png
shot2.png
shot1.png

I need to open this ticket again.

There is a problem with the query when used on a WPML site.
As per my original post, I DON'T want to show any records unless there is an exact match for the shipping code.

HOWEVER, in it's current form, the filter can be circumvented by "toggling" between language versions.
hidden link

Is it necessary to duplicate the view and use a different view code for each language version?
Seems a bit redundant if it is.