[wp-trac] [WordPress Trac] #16854: wp_query does not handle multiple exclude author properly

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 14 11:35:11 UTC 2011


#16854: wp_query does not handle multiple exclude author properly
--------------------------+-----------------------------------
 Reporter:  commentluv    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.1
 Severity:  normal        |   Keywords:  needs-patch has-patch
--------------------------+-----------------------------------
 when making a query with $args containing

 {{{
 'author' => '-2,-3,-4'
 }}}

 line 2008 of wp-includes/query.php only uses 1 element of the array that
 is created from the
 {{{
 $q['author'] string
 }}}

 {{{
  $q['author'] = explode('-', $q['author']);
  $q['author'] = (string)absint($q['author'][1]);
 }}}

 I have attached a patch that works with 1 or more excluded authors

 essentially it, implodes the array back into a string of author ID's
 rather than selecting only element [1] of the exploded array

 {{{
 $q['author'] = explode('-', $q['author']);
 $q['author'] = implode('',$q['author']);
 }}}

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


More information about the wp-trac mailing list