WordPress 3.6 get_users function wonkiness
-
Interesting oddity when I upgraded to 3.6 this morning. A plugin I wrote uses the get_users() function to fetch users that are assigned to one of the roles in a given list. It had been working fine right up until the upgrade.
I finally tracked the problem down to the “fields” parameter of the get_users() function. For some reason, when I was using that parameter, an empty result set was returned. Take it out, and it works just fine.
Code snippet is below for reference. I’m not sure if this is a bug, or if something changed about the way one is supposed to use the get_users() function.
$meta_query = array('relation' => 'OR'); foreach($add_roles as $role) { $meta_query[] = array( 'key' => $table_prefix.'capabilities', 'value' => $role, 'compare' => 'like' ); } //get all eligible users $args = array( 'meta_query' => $meta_query, 'orderby' => 'display_name', 'order' => 'ASC', 'fields' => array('ID, display_name'), ); $users = get_users($args);
- The topic ‘WordPress 3.6 get_users function wonkiness’ is closed to new replies.