The command line interface for WordPress, called WP-CLI, is installed for all hosts on Servebolt and is available when you log in to your site with SSH. You can only use WP-CLI in the webroot directory of your WP site and not outside it. To see the full command manual for WP-CLI, first navigate to your webroot and run the command:
How WP-CLI commands are structured is that the first word is always
wp. After comes the section you want to alter in your WP instance, followed by the action keyword that actually alters that section. Lastly, you sometimes have to give a necessary name or value to set.
You can also add additional parameters which always begin with two hyphens and possibly a variable assigned to it with an equals sign. An example would be:
wp plugin install servebolt-optimizer --activate --version='1.0'
Here you can see that we initiate WP-CLI with
wp. Focuses on the
plugin section of your site whilst wanting to
install a plugin by the name or value of
servebolt-optimizer. Lastly, we add two parameters, the first meaning we want to
activate it right away and it should be
version 1.0. Remember that it is a good idea to put values in single quotes so that the command line doesn’t interpret it as another command.
If something is missing in your command, WP-CLI will do its best to try to tell you what extra is needed or needs changing.
wp core you can control the very core of your WP instance. Here you can download, install, change core functionality, etc.
wp core download– Will download the core WordPress files.
wp core install– Will install WordPress via the command line.
wp core verify-checksums– Is used to check if all core files are correct or if something is missing. Useful if you think your site has been hacked.
wp core update– Will update WordPress to its latest release.
wp core version– Reports which version your site is currently on.
wp core itself will give you all core commands available and potential values and parameters.
You can manage, update, download, install and uninstall plugins by running varieties of the
wp plugin command.
wp plugin install– Will try to install the plugin given.
wp plugin activateor
deactivate– Will activate the plugin given. With
deactivateinstead, you can deactivate the plugin.
wp plugin delete– Will delete the plugin given.
wp plugin list-. Gives you a list of all plugins installed on your site.
wp plugin update– Will update the plugin given.
A good example here would be to install WooCommerce like so:
wp plugin install woocommerce --activate
wp plugin itself will give you all plugin commands available and potential values and parameters.
wp theme you can control, activate/deactivate, and install/uninstall your themes. It has mainly the same actions as with plugins, so I’ll cover the differences only.
wp theme enableor
disable– Enables/disables a theme given.
wp theme status– Gives you useful information about a given theme.
wp theme itself will give you all theme commands available and potential values and parameters.
Give us your feedback on this article
Servebolt has launched Accelerated Domains!
Accelerated Domains is a service that greatly improves and optimizes your site on these four areas: Performance, Scalability, Security and the Carbon footprint of your website.