Configuring WP-CLI on Windows 10

Actually, I figured out how to do this, and it’s actually really easy to do! Which is awesome because I think it’s a great simple way to work! First up, you don’t want to change the PATH for PHP in bash. So you’ll want to remove that. Instead, what you are doing is using bash … Read more

WP-CLI can’t list posts

(I’ll post here @photocurio’s answer, as it’s hidden in the comments) wp post list –post_type=page # will show only post-type=page wp post list # will show only post-type=post It’s counter-intuitive command is also mis-documented, (which I hope to change), because: pages are posts. There’s no “wp page list” command. The docs don’t mention that the … Read more

How to change a post attribute to homepage using WP CLI?

To set the site’s static home page with WP-CLI, you should be able to do something like this: wp option update show_on_front “page” wp option update page_on_front {$page_id} … where {$page_id} is the ID of the page you want to be the front page. (Your question was originally tagged multisite—if you’re running a Multisite installation, … Read more

Ask WP-CLI latest core WordPress version released

wp core version displays your current WordPress version. $ wp core version 5.2.4 Adding –extra shows extended version information. $ wp core version –extra WordPress version: 5.2.4 Database revision: 44719 TinyMCE version: 4.940 (4940-20190515) Package language: en_US wp core check-update lists the most recent versions when there are updates available, or success message when up … Read more

Get WP CLI to hide debug warnings and notices in JSON output, same setting as website

A quick manual solution is to direct all error output to a log file somewhere or even to /dev/null. With your command this would look like this: wp plugin list –fields=name,status,update,version,update_version,title –format=json 2> ./cli-command.err.log If you totally don’t care about the errors, warnings and notices, you could send it to /dev/null like this: wp plugin … Read more

Setting boolean and array values using wp theme mod set

Funny how you find the answer just after posting a question. Posting here, in case someone comes looking for it. As per @Kero’s comment above, that’s correct. The command-line option will only recognise strings. There is however an eval-file command that can be used to achieve this (and now that I have discovered it, a … Read more

How to perform WordPress backups using wp-cli?

You can use the WP-CLI command wp db export <filename> Run the command from within the home directory for the install. Now, you have a database included in your files. Zip up the directory and move it aside. Now you can perform the upgrade, and if something breaks, replace with the old site and import … Read more