Export list of users with first and lastname in WP-CLI

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 … Read more

How can I run a WP-CLI command as authenticated user?

By default WP-CLI executes every command as unauthenticated (logged-out) user. To execute a command as any existing WordPress user you can use the global –user parameter, which accepts an user ID, login, or email address. $ wp nurse check –all –user=1 You’ll get all other global parameters listed when running $ wp –help or $ … Read more

WP-CLI works on non WP-CLI installed WordPress instance?

Yes, of course it does, as long as you also have SSH access to the instance (it won’t work over FTP). There’s nothing special about WordPress instances installed via WP-CLI. Commands such as wp core download and wp core install perform the same actions you would normally do when installing manually.

wp-cli import theme sample data

I just filed to a PR to the WPTest.io “theme test data”. In short it’s the following series of commands. You just have to replace The remote request provider. In the example it’s curl, but you could use wget or others as well The remote request target. In the example it’s the wptest.io XML/WRX file. … Read more

wp media regenerate unknown –image_size parameter

I was able to duplicate the issue when running WP-CLI version 1.1.0, but the command worked successfully when I updated to the nightly build using: wp cli update –nightly The –image-size parameter was added to wp-cli/media-command on April 13, 2017 after the current stable release of WP-CLI v1.1.0 on February 1, 2017. This feature is … Read more

Disable comment windows for all existing posts (pages/blogposts)

Here is an untested suggestion for wp-cli approach: We can list post IDs of published posts with open comment status with: wp post list –post-status=publish –post_type=post comment_status=open –format=ids and update a post to a closed comment status with: wp post update 123 –comment_status=closed where 123 is a post id. We can then combine those two … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)