WP-CLI sudden empty response

I set up WP-CLI on a new server this past Monday, which worked as expected and scripts I’ve made worked following with no issue. Yesterday, running the same script gave errors: PHP Warning: array_slice() expects parameter 1 to be array, null given in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php on line 610 PHP Warning: Invalid argument supplied for foreach() in … Read more

Why would WP-CLI and WP Admin show different list of plugins with updates?

I’m running a local dev instance of WP on my MacBookPro (WP 4.6.1 and WP-CLI 0.24.1). Can anyone explain why I might see a list of 5 or 6 plugins that have available updates when I go to Admin’s update page (/wp-admin/update-core.php?force-check=1) but when I run wp-cli from the command line (wp plugin update –all … Read more

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

I’m writing a one-off script to update some posts in the database. Whenever there is an error in my script, it fails silently. I’ve followed the suggestions in this Github issue without success: https://github.com/wp-cli/wp-cli/issues/706 I’ve also tried running my script with debug set to true: wp –debug eval-file my-script.php And I’ve tried setting WP_DEBUG to … Read more

Categories not shown in admin after adding woocommerce products via wp wc cli

After the following script is run wp wc product create –name=”b” –categories=32 –user=user Output is printed: Success: Created product 1370. But no categories are shown in wp-admin/WooCommerce->Products page for the newly added product. I have followed Find Product Category IDs to get category id. Tried to use [32], [’32’] instead of 32. The result is … Read more

Configuring WP-CLI on Windows 10

I’ve installed php5-cli using bash, but WordPress is using XAMPP’s PHP 7 install. I’ve added /mnt/c/xampp/php to the PATH, and I’ve explicitly used export WP_CLI_PHP=’/mnt/c/xampp/php’ in .bashrc. But when I do wp –info, I get: PHP binary: /mnt/c/xampp/php/php.exe PHP version: 5.5.9-1ubuntu4.22 php.ini used: /etc/php5/cli/php.ini PHP binary seems correct, but the last two variables refer to … Read more