[wp-hackers] Filter search query before execution

Tom Jenkins tom at thejenkinsweb.com
Thu Sep 16 00:04:11 UTC 2010


So why not just highjack the post method through javascript, make your
changes, then forward the post method onto wordpress?


Tom


On Wed, Sep 15, 2010 at 5:12 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:

> It doesn't look like that filter is what i need.  I want to capture the
> search query before anything is done with it to change it, not while its
> doing some queries to find results for the search.
> On Wed, Sep 15, 2010 at 1:22 PM, scribu <scribu at gmail.com> wrote:
>
> > On Wed, Sep 15, 2010 at 9:28 PM, Ryan Bilesky <rbilesky at gmail.com>
> wrote:
> >
> > > Best i can find this is a really new filter, only since 3.0 and I can't
> > > seem
> > > to figure out how to get it working.  I setup a simple example on my
> demo
> > > install of WP.  I had my filter function return Hello World and
> searched
> > > something else that didn't yield any results.  Hello world should give
> > the
> > > the initial hello world post, i get nothing.
> > >
> >
> > You should look at what the filter expects first, before returning
> > something
> > else:
> >
> > function my_posts_search( $sql ) {
> >  var_dump( $sql );
> >  return $sql;
> > }
> >
> > add_filter( 'posts_search', 'my_posts_search' );
> >
> >
> > --
> >  http://scribu.net
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list