[wp-hackers] Replacing WordPress search

Mike Bijon mike at etchsoftware.com
Mon Feb 18 18:51:16 UTC 2013


Hi Tom,
You can modify or replace the standard search query using the
'posts_search' filter. Here's a quick example:
https://gist.github.com/mbijon/4979627

There are also several tickets on Trac related to search. You may be able
to grab some of the SQL from there and shortcut some of your custom work.
* This one is open & may be included soon:
http://core.trac.wordpress.org/ticket/7394
*  This one was closed because it used MySQL's FULLTEXT, but if you have
that enabled it's a good example of making that work:
http://core.trac.wordpress.org/ticket/14722

-Mike



> Hello
>
> I have some complex searching to do, for which I'll need to build some
> custom searches (db queries). I'm going to end up with 4 calls to
> get_post() based on some custom query vars.
>
> If possible, I'd like these to appear 'normally' using standard search.php
> template loop. Is there a nice hook where I can stop WordPress performing
> any queries itself, but still inject my own list of posts?
>
> Tom
>
> --
> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> http://twitter.com/tcbarrett
>
>


More information about the wp-hackers mailing list