WordPress Fixes: Troubleshooting WP-CLI Issues

    WP-CLI execution errors are often fairly easy to fix, allowing the WP-CLI tool to work as expected so you can focus on what's most important for maintaining your WordPress site!


    WordPress Fixes: Troubleshooting WP-CLI Issues


    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.

    Troubleshooting WordPress Command Line Interface (WP-CLI) Issues

    WP-CLI is commonly used to be able to run any action or process that exists in the WordPress Dashboard (wp-adminbut 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.


    If you are getting started with Managed WordPressthen learning WP-CLI will, in time, allow you to manage your efforts more effectively.


    To be able to run WP-CLI on your site's server, you will need to use the SSH credentials from your Nexcess Portal and then use a command-line application such as PuTTY on Windows devices Terminal on Mac devices.


    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:


    cd public_html



    WordPress Fixes & Troubleshooting: wp cli info


    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.



    WordPress Fixes & Troubleshooting: wp --info


    This wp --info command will return information about the WordPress installation where you are running WP-CLI:


    wp --info



    WordPress Fixes & Troubleshooting: Most Common Issues


    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:


    wp --skip-theme


    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:

    wp --skip-plugins


    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


    Conclusion

    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.

    Next Steps?

    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 WordPressincluding 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

    24-Hour Assistance

    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

    Need more help? The Applications, WooCommerceand WordPress sections within the Nexcess Knowledge Base are important resources for those seeking additional knowledge. Or, check out our related articles below.

    New Customers: Fully Managed Hosting Solutions

    Not a Nexcess customer yet? Check out our fully managed hosting solutions. The option to chat with an expert is also available.

    Related Articles


    Was this article helpful?

    Send feedback

    Can’t find what you’re looking for?

    Our award-winning customer care team is here for you.

    Contact Support