[wp-trac] [WordPress Trac] #25587: wp_search_stopwords filter shouldn't be cached

WordPress Trac noreply at wordpress.org
Wed Apr 23 16:47:30 UTC 2014


#25587: wp_search_stopwords filter shouldn't be cached
--------------------------+-------------------------
 Reporter:  alex-ye       |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Query         |     Version:  3.7
 Severity:  normal        |  Resolution:  maybelater
 Keywords:  has-patch     |     Focuses:
--------------------------+-------------------------
Changes (by wonderboymusic):

 * keywords:  has-patch needs-testing => has-patch
 * status:  new => closed
 * resolution:   => maybelater
 * milestone:  Awaiting Review =>


Comment:

 You can filter every object instance of WP_Query differently:

 {{{
 function a_whatever() {
     remove_filter( 'wp_search_stopwords', __FUNCTION__ );

     // do whatever you want
 }

 function b_whatever() {
     remove_filter( 'wp_search_stopwords', __FUNCTION__ );

     // do whatever you want differently
 }

 add_filter( 'wp_search_stopwords', 'a_whatever' );

 $q = new WP_Query( array( 's' => 'woo' ) );

 add_filter( 'wp_search_stopwords', 'b_whatever' );

 $q = new WP_Query( array( 's' => 'hoo' ) );

 }}}

 I don't see a great use case for filtering the same object multiple times.
 If there is one, please enlighten us and reopen.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25587#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list