[wp-trac] [WordPress Trac] #9886: Cannot reliably add query arguments to all WP_Query objects

WordPress Trac wp-trac at lists.automattic.com
Wed May 20 06:02:54 GMT 2009


#9886: Cannot reliably add query arguments to all WP_Query objects
--------------------------+-------------------------------------------------
 Reporter:  westi         |       Owner:  westi
     Type:  defect (bug)  |      Status:  new  
 Priority:  normal        |   Milestone:  2.8  
Component:  Plugins       |     Version:       
 Severity:  normal        |    Keywords:       
--------------------------+-------------------------------------------------
 I have a simple plugin which adds and checks query arguments using the
 following filters:

 {{{
 add_filter( 'query_vars', array(&$this,'register_query_var') );
 add_filter( 'posts_where', array(&$this,'posts_where') );
 add_filter( 'post_limits', array(&$this, 'post_limits') );
 }}}

 It then uses get_query_var() to see if the new vars are set and modfies
 post_where and post_limits.  Unfortunately for new WP_Query objects the
 calls to get_query_var() will get the value that was used in the main loop
 or calls to query_posts.

 This makes nested loops hard :-(

 I think we need to make the filters like post_where pass the WP_Query
 object as an extra argument.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9886>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list