Wp-Cli is a command line tool specifically made to manage your WordPress websites through the command line. By entering some simple commands you will be able to carry out tasks such as backing up, installing or updating plugins and even publishing content, without having to log in to your WordPress admin. Wp-Cli saves you time by getting rid of the need to navigate web pages to run your site and is especially useful if you are a WordPress developer or System administrator. In this guide, I will show you how to install Wp-Cli and how to carry out simple commands. It should be noted that in order to install Wp-Cli you will need to make sure you have a hosting account with SSH access. Other system requirements are PHP 5.3.2 or later, WordPress 3.4 or later and a Unix like environment such as Linux. We provide, and install WP-Cli for you with our hosting.
How to install Wp-Cli
Step 1. The recommended way to install Wp-Cli is by downloading the Phar build, making it executable, and placing it on your PATH. The latest version of the file can be found at https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.pharStep 2. Using the cURL command type curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar This will download and extract the Wp-Cli files to your root user directory. Step 3. Next, it’s time to set the permissions to make it executable. Enter the following command: chmod +x wp-cli.phar Step 4. It's best to move the Wp-Cli.phar to a folder and rename it ‘wp’. This will help you use the Wp-Cli commands just by typing ‘wp’ at the start of the commands. That’s all there is to installing Wp-Cli! If you need more information for troubleshooting, that can be found over at https://make.wordpress.org/cli/handbook/installing/. Now, let’s jump into an overview of some simple commands we can make.
Using the Wp-Cli help system
Wp-Cli comes with a full help system. This can be accessed by typing: wp help.
Installing themes with Wp-Cli
Importing and installing themes is a lot quicker through Wp-Cli as opposed to logging in via WordPress admin and activating it. Wp-Cli connects your server directly to the WordPress theme repository allowing it to install themes in a second. Let's use the themes ‘twenty seventeen’ as an example. Simply type in the following command: wp theme install twentytenLikewise, if you wanted to install the theme ‘simplicity lite’, you would just need to enter: wp theme install simplicityliteWhile this will install the themes on your site it will not activate them. To do that you will need to type the command: wp theme activate twentyten
[caption id="attachment_6156" align="alignnone" width="546"] The command display when installing the Twenty Ten theme.[/caption]
Installing Plugins with Wp-Cli
Just like with the themes, plugins can be installed straight from the official repository. Once again, installation is seamless and takes next to no time. For example: wp plugin install yoastseoThe above command line will install the Yoast SEOplugin on your website. To activate it just simply type: wp plugin activate yoastseo To deactivate any plugin just type: wp plugin deactivate yoastseo. Simple stuff!
Updating Themes, Plugins and WordPress core with Wp-Cli
Time-consuming tasks such as updating core features can be a hassle, but thankfully this can be taken care of easily through some command inputs. To update WordPress to the latest, stable version, simply enter: wp core updateWp-Cli will also let you update to the specific version of WordPress you want. So if you want to update to WordPress version 3.9 instead of 4.2, simply enter: wp core update -- version=3.9When it comes to updating plugins you can update all at once or just specify a single one. To update all enter: wp plugin update -- allLikewise, for a specific plugin, you should enter: wp plugin update yoastseoThis exact method applies for themes as well and would be as follows: wp theme update -- all , or, wp theme update twentyten
Need Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on. From £1.60 / month.
Do you need to increase the memory limit in WordPress? Getting an error about memory Exhausted? The memory limit is one of the most common WordPress errors as the default limit of memory in WordPress is only set to 64mb! But there’s good news! The Memory Exhausted error is one...
A vulnerability has been discovered in the “All In One WordPress Migration” WordPress plugin. All versions earlier than, and including 6.97 contain a vulnerability which allows Cross-Site Scripting (XSS).With over 2 million active installations, this vulnerability has the potential to be high impact, however, this is lessened by the nature...
HostPresto will be launching a European point of presence in the coming weeks, specifically in Amsterdam. For customers needing their data located within the EU still please contact support to request migration to this location with ticket subject ‘EU Migration’. We will ensure this is actioned well before the Brexit...