[wp-hackers] Seeking SQL advice to identify performance problem

scribu mail at scribu.net
Wed Jun 20 16:38:41 UTC 2012


On Wed, Jun 20, 2012 at 4:52 PM, Simon Blackbourn <piemanek at gmail.com>wrote:

> You can use the get_users() function [1] with the 'fields' parameter set
> to 'all_with_meta', and then perform a usort on the results:
>
> $args = array(
> 'number'     => 1000000, //  unfortunately you can't use -1 here
> 'fields'     => 'all_with_meta', // required
>                        'exclude' => array( 1 ) // user IDs to exclude
> );
>
> $user_list = get_users( $args );
>

Actually, unlike WP_Query, users are not paginated by default, so if you
don't pass the 'number' parameter at all, you'll get all the users.

As for the "magic" that Otto mentioned, here's a blog post about it:
http://scribu.net/wordpress/the-magic-of-wp_user.html

-- 
http://scribu.net


More information about the wp-hackers mailing list