User Query Doesn't work?
-
I tried to use the following, which from WP documentation should show all the fields of all “subscribers”. However, I’m not sure your plugin is properly extending the user profiles now… because this code does NOT give me any of your custom meta data… Can you please indicate if this is true? If so, can you tell me how to query the custom meta data of all users by filtering them with a query? For example, our list has NFL teams, I want “all users with NFL team Arizona Cardinals”, or better yet, “all users with NFL team != None”.
//get all users as objects that are subscribers $args = array('role' => 'subscriber', 'fields' => 'all_with_meta'); $user_query = new WP_User_Query($args); if (!empty($user_query->results)) { echo json_encode($user_query->results); } else { echo 'No users found.'; }
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘User Query Doesn't work?’ is closed to new replies.