How to Manage WordPress With WP-CLI

Want to manage WordPress with WP-CLI? Hee’s how to launch and connect using the Cloudways Platform.

Cloudways Product avatar
Written by Cloudways Product
Updated over a week ago

WP-CLI is a set of command-line tools for managing WordPress installations on a server. It allows the WordPress admin users to carry out different administrative tasks without actually using a web browser. This management through the command line interface allows the users to manage their WordPress websites by executing a set of defined commands. The scope of the tasks mainly includes upgrades, taking database backups, publishing new posts, and much more. WP-CLI requires SSH access to connect to the respective application on the server.

In order to have a better understanding, we have listed below some of the basic WP-CLI commands. We will be using a few of the following commands:

  • wp home

  • wp option [add|update|delete|get]

  • wp plugin [activate|deactivate|toggle|path|update|uninstall|delete|status|install]

  • wp post-meta [get|delete|add|update]

  • wp post [create|update|delete]

  • wp theme [activate|path|delete|status|install|update]

  • wp transient [get|set|delete|type]

  • wp user-meta [get|delete|add|update]

  • wp user [list|delete|create|update]

We will explain some of these in greater detail below.

You must first connect to your server via SSH. If you have never done it yet, the following KBs will help:

With an SSH session open, we can now move to WP-CLI itself.

Managing WordPress Plugins via WP-CLI

In this snapshot, we see how plugins can be managed through the WP-CLI interface. Here we have used the plugin status, activate, and deactivate functions. However, other functions can also be used. For reference:

wp plugin [activate|deactivate|toggle|path|update|uninstall|delete|status|install]

Listing All Available WP-CLI Commands

Typing wp or wp help will show the entire list of the WP-CLI commands that can be used to perform management/administrative tasks.

Checking Version and Updating WP Core

Since our version is already updated to the latest, the appropriate version is shown.

You can also manage users using WordPress CLI so Click Here to learn how.

That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.

Did this answer your question?