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.

1 Answer
1

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.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *