How can I get the WP-CLI eval-file command to report errors to stderr?

Adding the following lines to the top of your script, as recommended in Github issue, should report any runtime errors: ini_set( ‘display_errors’, 1 ); error_reporting(E_ALL); However, it will not report syntax errors, which is a big headache as you try to write your script. This is my workaround for that: Add following line to bottom … Read more

Unable to install plugins from wp-cli

Caching plugins usually require some additional manual work in moving some files from the plugin directory to the root of the wp-content directory and maybe some wp-config.php changes. It is possible that the plugin fails to initialize due to that.

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

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

Execute wp-cli command on all sites on server

Here’s an example using find with a directory type and zero maxdepth: $ find /srv/users/serverpilot/apps/*/public/ \ -type d \ -maxdepth 0 \ -exec /usr/local/bin/wp core update –path={} \; or in a single line: $ find /srv/users/serverpilot/apps/*/public/ -type d -maxdepth 0 -exec /usr/local/bin/wp core update –path={} \;

WP-CLI alias: connect with ssh proxy

I created simillar configuration to yours and proxy is working for me. My config looks like: Host production HostName xxx.xxx.xxx.xxx ProxyCommand ssh -q -W %h:22 vagrant ForwardAgent yes Host vagrant HostName 127.0.0.1 User vagrant Port 2222 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile /path/to/.vagrant/machines/default/virtualbox/private_key IdentitiesOnly yes ForwardAgent yes LogLevel FATAL I’m treating my vagrant local … Read more

WP-CLI Get Site ID from its url

It looks like –url isn’t working to filter the wp site list output. So instead one could try: wp site list | awk ‘{ if( $2 == SITE_URL_STRING ) print $1; }’ where we use the awk trick from here, to filter the url column and display the blog_id column. Here we must replace SITE_URL_STRING … Read more

wp-cli silently fails with 255 when running wp core install

I was missing some php extensions that wp-cli and/or WordPress needed but there is no error output stating as much. I’m guessing it was specifically the missing mysqli extension. I used a WP-CLI command to test the base container for missing extensions and now I have sudo docker-php-ext-install gd sockets mysqli exif in my config.yml. … Read more

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