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?

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

Output of var_dump($targetUsersIDs);

array (size=3)
0 =>
public ‘ID’ => string ‘1’ (length=1)
1 =>
public ‘ID’ => string ‘2’ (length=1)
2 =>
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 *