Troubleshooting: WP-CLI Isn’t Working
WP-CLI should work without issue and you should normally be able to see the output from your commands. But if you ever have issues, you can check here for some common troubleshooting methods.
Check the Basics
WP-CLI should work without issue and you should normally be able to see the output from your commands. It’s important to remember however that you must be in the user’s html folder.
When attempting to run WP-CLI commands in the improper directory the system will display the following message:
Error: This does not seem to be a WordPress install. Pass --path=`path/to/wordpress` or run `wp core download`.
To switch to the proper directory simply type:
cd ~/html
PHP Fatal error: Call to undefined function #
This error is typically encountered when you’ve modified your wp-config.php in a way that calls WordPress functions. This causes trouble because the values in wp-config.php are loaded prior to the WordPress core settings.
Solution:
Comment out or remove any modifications you’ve made to wp-config.php such as an add_filter or add_hook function.
The automated updater doesn’t work for versions before 3.4 #
WP-CLI is unable to update any version of WordPress before version 3.4.
Solution:
Update to the latest version after ensuring you have a current backup:
wp core update --version=x.x.x --force Example: wp core update --version=4.8.2 --force
Plugin or Theme Blocking WP-CLI
If you attempt to use WP-CLI and a plugin or theme is blocking WP-CLI from executing properly, you can skip that plugin or theme.
- Skip All Plugins and Themes
wp --skip-plugins --skip-themes
- Skip a Single Plugin or Theme
wp --skip-plugins=$PLUGIN_SLUG_NAME
or
wp --skip-themes=$THEME_SLUG_NAME
Tip: |
| If the commands above do not work, try using quotation marks ("") around the plugin/theme slug name. |
Additional Troubleshooting:
If WP-CLI isn't working and provides no output, it's possible that all the available PHP memory is being eaten up by active plugins. Attempt to disable plugins from wp-admin or in the database, then attempt to run your WP-CLI commands. If you are able to run commands after disabling plugins, you will need to increase the memory_limit.
The –debug flag can be used to see where WP-CLI is failing. Running the –debug flag should produce the following output:
[b@host]$ wp plugin list [b@host]$ wp plugin list --debug Debug (bootstrap): No readable global config found (0.009s) Debug (bootstrap): No project config found (0.009s) Debug (bootstrap): No package autoload found to load. (0.045s) Debug (bootstrap): ABSPATH defined: /home/sample/public_html/ (0.046s) Debug (bootstrap): Begin WordPress load (0.046s) Debug (bootstrap): wp-config.php path: /home/sample/public_html/wp-config.php (0.046s)
In this case, the –debug flag stops reading after the wp-config.php due to bad customizations, run the following command:
[b@host]$ tail -1 wp-config.php define( 'WP_CACHE', true );
or
[b@host]$ tail -1 wp-config.php define( 'WP_CACHE_DIR', '/var/www/html/wp-content/cache' );
If these steps don't resolve or describe your WP-CLI, you may want to check the WordPress forum on common issues with wp-cli: https://make.wordpress.org/cli/handbook/common-issues/