One of the most useful tools available when it comes to managing WordPress sites remotely is WP-CLI. WP-CLI is a command line interface specifically designed for WordPress. It allows you to update themes and plugins, create users, create posts, and so much more all without ever visiting WP admin.
WP-CLI is available via SSH on all Flywheel sites hosted on our Flywheel Cloud Platform. For information on connecting to your sites via SSH, please read this article.
WP-CLI is invoked by typing wp
. WP-CLI includes over 40 commands, which can all be viewed here or by simply typing wp
. A lot of these commands take subcommands as additional arguments, such as wp user
. Typing wp user
on its own will list out its available subcommands.
An example of running a command to retrieve a list of users looks like this:
$ wp user list +----+------------+--------------+---------------------------+---------------------+------------------------------+ | ID | user_login | display_name | user_email | user_registered | roles | +----+------------+--------------+---------------------------+---------------------+------------------------------+ | 1 | admin | Trevan | [email protected] | 2013-02-01 18:43:29 | administrator,backwpup_admin | +----+------------+--------------+---------------------------+---------------------+------------------------------+
Now that you see how to run WP-CLI commands, it’s really just a matter of finding the command you want to run to accomplish what you’re looking to do. Here are a few commands that seem to come in most handy!
wp plugin list
wp plugin install woocommerce --activate
wp plugin deactivate woocommerce
wp user update [email protected] --user_pass=new-password
wp user add-cap [email protected] administrator
wp db size --tables
wp search-replace old new
wp transient delete --all
wp post generate --count=10
wp comment delete $(wp comment list --status=spam --format=ids)
wp cache flush
There are a few WP-CLI commands that you won’t be able to use on Flywheel sites, primarily due to security and permissions restrictions.
If you have any questions our Happiness Engineers are here to help!
New to Flywheel? Start here, we've got all the information you'll need to get started and launch your first site!
View allLearn all about managing your Flywheel user account, Teams and integrations.
View allFlywheel hosting plans include a ton of great features. Learn about how to get a free SSL certificate, set up a staging site, and more!
View allAll the server and setting info you'll need to help you get the most out of your Flywheel hosting plan!
View allTips and tricks for managing your sites on Flywheel, including going live, troubleshooting issues and migrating or cloning sites.
View allLearn more about Growth Suite, our all-in-one solution for freelancers and agencies to grow more quickly and predictably.
Getting started with Growth Suite
Growth Suite: What are invoice statuses?
Growth Suite: What do client emails look like?
Learn more about Managed Plugin Updates, and how you can keep your sites up to date, and extra safe.
Restoring Plugin and Theme Management on Flywheel
Managed Plugin Updates: Database upgrades
Managed Plugin Updates: Pause plugin updates
We can help! Check out our Brand Resources page for links to all of our brand assets.
Brand Resources