I want to export a CSV file with a list of my Wordpress site users with WP-CLI. I can do this but I'm getting my users first and lastname together in one column (display name), I would like to get them each in their own column. Is there a way to do this? I can't find first and lastname as available options in the docs that lists optional fields.

up vote 3 down vote accepted

According to the documentation for wp user list, the fields argument accepts any valid WP_User_Query field.

Thus, you can simply use wp user list --fields=first_name,last_name --format=csv to list all users with their first and last names. Of course you can add any other fields that you need.

Note: You can get the documentation for each command using the --help flag, where things like that are mentioned.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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