title: Wordpress get_users timeout on big user database
body: <p>I have a database in a Wordpress project with over 10000 users, I want to use get_users function to get all of them and then loop through each but I'm having timeout problems. If I pass to the function a limit number it works, but I need to get all the users. </p>
  
  <pre><code>//This works as expected
  $Users = get_users(array( 'number' =&gt; '5000' ));
  </code></pre>
  
  <p>I thought about doing calls to the function by batches of 1000 using an offset value and adding the results to a main array with all the users but it won't work either. Does this make sense at all? Which would be the right solution to query long databases of users in Wordpress?</p>
  
  <pre><code>$totalUsers = count_users();
  $batchSize = 1000;
  $batchesCount = ceil($totalUsers['total_users'] / $batchSize);
  $Users = array();
  
  for ($count = 0; $count &lt; $batchesCount; $count++) {
    $args = array(
      'number' =&gt; $batchSize,
      'offset' =&gt; $count * $batchSize,
    );
    $batchNewUsers = get_users($args);
    $Users = array_merge($Users, $batchNewUsers);
  } 
  </code></pre>