[wp-hackers] Filter search query before execution

Ryan Bilesky rbilesky at gmail.com
Wed Sep 15 16:38:25 UTC 2010


so I am looking for a way to filter search queries entered though the
wordpress search.  But before wordpress receivers the results, I want to
filter it to normalize the query.  I am using a plugin the enhances the
search and allows the search to search across tags, categories, ect.  Now I
am using tags to store locations, so a post might have two tags "Seattle"
and "WA" for Seattle Washington.  Now if a user searches for Seattle
Washington that wouldn't work, I need to convert Washington to the
abbreviation WA.  I have a simple enough function to convert states names to
abbreviations, its just a matter of getting a hold of the search query
before its starts generating results and changing it.

Now here's the problem, I looked at the filter reference on codex and I
could not find a filter for this purpose.  Am I missing something?  What
would be the best way to accomplish this, and I am not opposed to hacking
the core if need be.


More information about the wp-hackers mailing list