[wp-trac] [WordPress Trac] #23849: Unexpected results when running WP_User_Query with role and meta_query

WordPress Trac noreply at wordpress.org
Fri Sep 27 05:40:51 UTC 2013


#23849: Unexpected results when running WP_User_Query with role and meta_query
--------------------------+------------------------------
 Reporter:  layotte       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Users         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |
--------------------------+------------------------------

Comment (by takien):

 Thanks '''SergeyBiryukove''' mentioned my ticket was duplicated to this.

 Here is my quick and dirty fix, at lest until it patched.

 {{{
 add_action('pre_user_query','pre_user_query_fix');

 function pre_user_query_fix_callback ( $matches ) {
         return ') AND '.preg_replace('/(OR  |AND
 )/i','',rtrim($matches[0],')'));
 }
 function pre_user_query_fix( $vars ) {
         $vars->query_where = preg_replace_callback('/(.*?)
 (.*?)(\'wp_capabilities\')(.*?)%\'\)
 \)/i','pre_user_query_fix_callback',$vars->query_where);
         return $vars;
 }
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/23849#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list