User_Query problem
-
Hi there, I’m running into some problems with User_query. For some reason the attached code isn’t working.
The issue is that $users is empty but not sure what I’m doing wrong to return a query with all of the site’s current users.
// Create the WP_User_Query object $user_query = new WP_User_Query(array()); $users = $user_query->results; // loop through each user foreach ($users as $user) { $id = sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)); // add points meta all the user's data add_user_meta($user->id, 'pitch_id', $id, false); } }
As always, any help very much appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘User_Query problem’ is closed to new replies.