Critical errors can be resolved by debugging your WordPress website, and those errors are often evidenced by the WP-CLI not being able to execute a command.
WP-CLI is commonly used to be able to run any action or process that exists in the WordPress Dashboard (wp-admin) but by command line. Therefore, WP-CLI not being able to execute a command would be caused by critical errors on the site. In several cases, the critical error could be caused by the active theme or active plugins on the site.
Admins can resolve critical errors by debugging the WordPress site. An example of a critical error would be the if the database cannot be connected to, which could be caused by database credentials in the site's wp-config.php file not being valid.
If you happen to be using the W3 Total Cache plugin with the Redis object caching options enabled, then the object-cache.php drop-in file in the wp-content folder might be causing the issue. Removing the object-cache.php drop-in file should clear the error being caused by object caching using Redis using the W3 Total Cache plugin on the site.
WordPress Fixes & Troubleshooting
WordPress Fixes & Troubleshooting: cd public_html
WP-CLI can only be used in the valid folder of your WordPress installation and the command to run would be:
If WP-CLI is having issues being executed, when you are trying to run any command, then the first command to see if you can run successfully is:
wp cli info
That command will check which version of WP-CLI is being used on the site's server.
This wp --info command will return information about the WordPress installation where you are running WP-CLI:
Th most common issues regarding the WP-CLI not executing commands correctly can be fixed by finding the exact problem that is being reported and how best to address it in the common issues help article.
Debugging Plugins & Theme Conflicts
WordPress Fixes & Troubleshooting: wp --skip-plugins --skip-themes
If you are trying to run any WP-CLI commands, and the error shows that it is being caused by the active theme or any of the active plugins, then it is recommended to execute WP-CLI without loading any plugins and themes using:
wp --skip-plugins --skip-themes
WordPress Fixes & Troubleshooting: wp --skip-theme
To find out if the issue is being caused by the active theme, then run this command:
WordPress Fixes & Troubleshooting: wp --skip-plugins
If you know the issue is being caused by one of the active plugins, then you can run this command:
WordPress Fixes & Troubleshooting: wp core version --skip-plugins=woocommerce
You can attempt to find out which specific plugin is causing the WP-CLI execution issue by bypassing that plugin, which is achieved by specifying the plugin slug for the plugin to skip. In this example, we are going to bypass loading the WooCommerce plugin when running a WP-CLI command:
wp core version --skip-plugins=woocommerce
WordPress Fixes & Troubleshooting: wp plugin list --status=active --format=table
To get a list of all of the active plugins on the site, you can first run this WP-CLI command:
wp plugin list --status=active --format=table
WordPress Fixes & Troubleshooting: wp plugin update --all
If an active plugin is causing the issue on the site and the plugin is outdated, then it would be worth updating the plugins on the site:
wp plugin update --all
About Finding the Root Cause of an Error
When checking errors being shown when trying to execute WP-CLI commands, you should be able to find the exact active plugin or plugins on the site that is or are causing the issue to occur. The error being shown can be traced back to a file within a specific plugin, and then checking the plugin slug that it is showing will make it very clear which is the specific plugin that is causing the site issue.
About Running the Most Current Versions of WordPress, Plugins, & Themes
Ideally, you should make sure that you are running the most current version of WordPress core and make sure that all plugins being used on the site are updated to the most recent versions. In some cases, the issue showing in the plugin will have been fixed in the most current version of the plugin. If the error is showing from a specific file that is being loaded in the active theme being used on the site, it is worth making sure that all themes have been updated. If you are using a premium theme on your site, make sure you have a valid license set for it to be updated on your site.
WordPress Fixes & Troubleshooting: wp plugin update --all
The WP-CLI command to run to update all themes installed on your site would be:
wp theme update --all
Most WP-CLI execution errors are relatively easy to fix, making sure that the WP-CLI is working correctly on your site. Keeping those errors fixed will allow you to keep using the WP-CLI for more important site tasks and cut down on the time you have to spend in the WordPress Dashboard (wp-admin) of your site.
Using Managed WordPress for your site hosting will make your site hosting easier and help your site's performance.
Useful WordPress Links for Developers & Admins
About the Nexcess Portal
Starting with a new hosting partner can be overwhelming. For that exact reason, we have prepared a Nexcess Portal Guide to make each client’s introduction to our Nexcess Portal easier.
How to Become a Nexcess Portal Pro
You signed up for an account with Nexcess but now what do you do? New systems can be intimidating to learn, so we’ve put together this guide to help explain what is in the portal and where to find it.
Read more about the Fully Managed WordPress Hosting and its benefits for your business.
Build Better Websites with Fully Managed WordPress Hosting
It’s hosting optimized for WordPress. That means a faster, more secure and scalable website. Smart monitoring tools are built-in to help you keep it that way.
It’s why WordPress Users Trust Nexcess Hosting.
We also have a variety of Nexcess support articles about WordPress, including how to get your site going with a number of different configuration options. These resources include a great article on setting this up for Migrating to Nexcess with managed WordPress and managed WooCommerce hosting.
If you need any assistance with the above-mentioned, don't hesitate to reach out. For 24-hour assistance any day of the year, Nexcess customers can contact our support team by email or through your Client Portal.
Useful YouTube > Nexcess Channel Links
Resources for More Information
New Customers: Fully Managed Hosting Solutions
- Scope of Support
- Getting started with managed WordPress and WooCommerce hosting
Migrating to Nexcess with managed WordPress and managed WooCommerce hosting
- Going live with your site in Managed WordPress and Managed WooCommerce hosting
- WordPress Cleanup 101: 9 Easy Ways To Clean Up and Optimize Your WordPress Site
- How to configure the Nexcess CDN with WordPress and CDN Enabler
- The Nexcess Plugin Performance Monitor
- Viewing AWStats for Managed WordPress & WooCommerce