get_users(…) only returns one use

I have an array of user IDs, I want to get data for each of these users. I first thought of writing a classic SQL query but I found WordPress has integreted functions for it. However, get_users(…) is only returning me 1 users though it should return 3. What am I doing wrong?

var_dump($targetUsersIDs);
$targetUsers = get_users([‘include’ => $targetUsersIDs]);
var_dump($targetUsers);

Output of var_dump($targetUsersIDs);

array (size=3)
0 =>
object(stdClass)[4785]
public ‘ID’ => string ‘1’ (length=1)
1 =>
object(stdClass)[4784]
public ‘ID’ => string ‘2’ (length=1)
2 =>
object(stdClass)[4783]
public ‘ID’ => string ‘4’ (length=1)

Output of var_dump(targetUsers);

array (size=1)
0 =>
object(WP_User) …

Read more here:: get_users(…) only returns one use

Leave a Reply

Your email address will not be published. Required fields are marked *