What is WP-CLI?
WP-CLI stands for WordPress Command Line Interface. It allows users to manage WordPress sites without a web browser.
WP-CLI is favored by many web developers, mainly due to its flexibility and efficiency. The tool is 100% text base – meaning instead of controlling your sites from WordPress Admin Dashboard, you control your site using command lines.
Server Requirements for WP-CLI
WP-CLI is not a plugin and doesn’t come together with WordPress installation by default.
To use WP-CLI for your website, you need to install it separately to your hosting server via SSH access.
To host WP-CLI, your hosting server needs to meet the following requirements:
- PHP 5.6 or later
- WordPress 3.7 or later
- UNIX-like environment (Linux, FreeBSD, Cygwin, etc)
Once WP-CLI is ready to your server, you can access WP-CLI from your local computer using an SSH client like Terminal (macOS) or Putty (Windows).
Ideally, you want to use WP-CLI on PHP 7.3 or above and the latest WordPress version for complete functionality. Running WP-CLI on a Windows hosting server is possible but with limited support.
Why WP-CLI?
Speed, accessibility, and efficiency are the three main reasons why many developers and server admins favor WP-CLI over the browser-based WordPress Admin Dashboard.
WP-CLI removes various unproductive tasks in web development. Switching from your screen to a browser, logging into your WordPress dashboard, navigating three pages deep to access a WordPress function – all these add up and increase the time spent on development. These steps are eliminated when you manage your sites directly from your SSH client using WP-CLI.
Common Use of WP-CLI and commands
Here are some common things (and its commands) you can do with WP-CLI. You can find all available WP-CLI commands on this page.
to this page for the full list of available commands.
Installing WordPress
$ wp core install --url=youwebsite.com --title=Your Website --admin_user=supervisor --admin_password=password [email protected]
Creating a new user
$ wp user create joe [email protected] --role=author
Changing user password
$ wp user update JOE --user_pass=PASSWORD
Changing user role
$ wp user set-role JOE editor
Installing WordPress plugins
$ wp plugin install yoast-seo
Activating WordPress plugin
$ wp plugin activate yoast-seo
Running database search-and-replace
$ wp search-replace 'old-image.jpg' 'new-image.jpg'
Clearing transient
$ wp transient delete --all
Running automated cron
$ wp cron event run --due-now
Create a new post
$ wp post create --post_type=post --post_title='A sample post'
Which Web Host Supports WP-CLI?
Because of its special server requirements, WP-CLI is not supported by some web hosts. And for those who support WP-CLI, the feature is only available in higher-tier plans. To make sure that you can use WP-CLI for your WordPress site, you need to picka WP-CLI ready web host. Below are some ideas.
1. Cloudways
Website: https://www.cloudways.com
Starting in 2011 in Malta, Cloudways is a provider of managed Cloud hosting solutions. It acts as a systems integrator, providing access to various services from Digital Ocean, Amazon AWS, Google Cloud, and more.
As far as web hosting companies go, Cloudways is considerably young. It entered the market in 2011 but since then has grown significantly. A large part of that growth is perhaps due to the relatively niche market space it occupies, as a systems integrator providing convenience for a bump in price.
Learn more in my Cloudways review.
WP-CLI Support
As the premier sponsor for WP-CLI Project, Cloudways offers WP-CLI supports to all their users. The WP-CLI tool is added to Cloudways SSH terminal by default. Users can access WP-CLI as soon as they get their Cloudways account.
2. TMD Hosting
Website: https://www.tmdhosting.com
About TMD Hosting
TMDHosting has been around for over 10 years and has been considered a reliable choice for those in need of a quality web hosting provider. Personally, I think TMD is one of the hidden gems in the hosting industry and I recommend them to friends and families who are in need of a reliable web hosting solution.
TMD's Shared Hosting Plans are especially suitable for bloggers or small businesses in need of an affordable and reliable web hosting solution. Not only do they offer stable server performances and tons of useful features, but they also have some of the best customer support teams in the industry.
Learn more in my TMD Hosting review.
WP-CLI Supports
TMD Hosting does not support WP-CLI in their standard shared hosting plans. To access WP-CLI, you need to go with TMD’s WordPress Hosting. Their lowest plan, named WordPress Starter, offers unlimited storage, premium support, and 60-day money-back guarantee at $5.95/mo.
3. Hostinger
Website: https://www.hostinger.com
Established 2004, Hostinger is a budget hosting company running on multiple data centers worldwide.
Hostinger went through rampant growth and expansion over the years. They achieve a huge milestone of having 1 million users, just 6 years from the day that they started. Today, the company manages over 29 million users and has established worldwide localized offices with 150 people working across 39 countries worldwide.
For more details and Hostinger server performance stats, read my in-depth Hostinger review.
WP-CLI Supports
Hostinger supports WP-CLI in all of their WordPress Hosting Plans (cheapest price at $1.99/mo) and Premium Shared Hosting (or higher) Plans. WP-CLI is not supported in their lowest shared plan (Single Shared) even though it’s priced the same as the cheapest WordPress plan.
4. GreenGeeks
Website: https://www.greengeeks.com
GreenGeeks is a web hosting company founded on the principles of environmental-friendly web hosting in 2006. Their headquarters are located in Agoura Hills, California but they have clients all over the world with data centers in the United States, Canada, and Netherlands.
The company has served over 35,000 customers with more than 300,000 websites. As a green hosting company, it has dedicated itself to leaving a positive energy footprint and replacing used energy with triple the energy credits that are used.
Learn more in our GreenGeeks review.
WP-CLI Support
WP-CLI is pre-installed in all GreenGeeks Shared and WordPress Hosting. Their cheapest plan, which allow you to host one WP site with 50 GB storage, starts at $2.95/mo.
5. BlueHost
Website: https://www.bluehost.com
Bluehost host more than 2 million websites on their platform and is extremely popular. The company is currently based in Burlington, Massachusetts, U.S. and offers a wide range of hosting options. The company BlueHost was sold to Endurance International Group (EIG) in 2010 and EIG is sold to Clearlake Capital for $3 billion in November 2020.
BlueHost is officially recommended by WordPress.org and a popular hosting choice among professional bloggers. I personally think BlueHost may be the right call for small businesses and individual bloggers who want a cheap and reliable hosting solution.
Learn more in our full BlueHost review.
WP-CLI Support
WP-CLI is not pre-installed on BlueHost hosting by default. However, the company does support WP-CLI in all its shared hosting plans. However, as root access is unavailable, the usual WP-CLI installation procedures do not work on BlueHost. Instead, a special “user-specific configuration” is needed to access WP-CLI from BlueHost Shared Hosting (detailed instructions here).
Final Thoughts
Almost all development tasks you can do on the Admin Dashboard can be done faster with WP-CLI. If you wish to work more efficiently with WordPress – check out WP-CLI.