0

I'm fairly new to wordpress/php development, so forgive me if this is a stupid question.

I'm trying to get a list of all the users with metadata in order to export them to a CSV file.

We currently have 69 users on the site, but the get_users() method only lists 4 users.

I'm currently using the below piece of code.

$args = array(
    'fields'       => 'all'
); 

$users = get_users( $args );

Thanks in advance

0

ederoock,

I'm not sure why you're only seeing 4 of the 69 users with the code provided, but I can tell you that the $fields parameter of the get_users() function can be set to 'all_with_meta'.

Change your array from 'fields' => 'all' to 'fields' => 'all_with_meta'

| improve this answer | |
  • Thanks MarketHub, this is bringing back most of the users. There seems to be something wrong with our users as well, only 27 of the 69 are displaying in the users page under wp-admin. – ederoock Nov 7 '15 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.