How to install WP-CLI to manage WordPress site

WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installations and much more, without using a web browser.

Currently WordPress CLI is regularly maintain by the group of companies.

how to install wp cli

What is WP-CLI?

WP-CLI is a command line interface for WordPress. The project’s goal is to offer a complete alternative to the WordPress admin; for any action you might want to perform in the WordPress admin, there should be an equivalent WP-CLI command.

Read more about WordPress WP CLI installation and configurations

How to use WP CLI Commands

WP-CLI provides a command-line interface for many actions you might perform in the WordPress admin. For instance, wp plugin install –activate (doc) lets you install and activate a WordPress plugin:

 $ wp plugin install user-switching --activate
Installing User Switching (1.0.9)
Downloading installation package from https://downloads.wordpress.org/plugin/user-switching.1.0.9.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'user-switching'...
Plugin 'user-switching' activated.
Success: Installed 1 of 1 plugins.

WP-CLI Commands Lists

Below is the list of main WP-CLI Commands:

CommandDescription
wp adminOpen /wp-admin/ in a browser.
wp cacheAdds, removes, fetches, and flushes the WP Object Cache object.
wp capAdds, removes, and lists capabilities of a user role.
wp cliReviews current WP-CLI info, checks for updates, or views defined aliases.
wp commentCreates, updates, deletes, and moderates comments.
wp configGenerates and reads the wp-config.php file.
wp coreDownloads, installs, updates, and manages a WordPress installation.
wp cronTests, runs, and deletes WP-Cron events; manages WP-Cron schedules.
wp dbPerforms basic database operations using credentials stored in wp-config.php.
wp dist-archiveCreate a distribution archive based on a project’s .distignore file.
wp embedInspects oEmbed providers, clears embed cache, and more.
wp evalExecutes arbitrary PHP code.
wp eval-fileLoads and executes a PHP file.
wp exportExports WordPress content to a WXR file.
wp findFind WordPress installations on the filesystem.
wp helpGets help on WP-CLI, or on a specific command.
wp i18nProvides internationalization tools for WordPress projects.
wp importImports content from a given WXR file.
wp languageInstalls, activates, and manages language packs.
wp maintenance-modeActivates, deactivates or checks the status of the maintenance mode of a site.
wp mediaImports files as attachments, regenerates thumbnails, or lists registered image sizes.
wp menuLists, creates, assigns, and deletes the active theme’s navigation menus.
wp networkPerform network-wide operations.
wp optionRetrieves and sets site options, including plugin and WordPress settings.
wp packageLists, installs, and removes WP-CLI packages.
wp pluginManages plugins, including installs, activations, and updates.
wp postManages posts, content, and meta.
wp post-typeRetrieves details on the site’s registered post types.
wp profile 
wp rewriteLists or flushes the site’s rewrite rules, updates the permalink structure.
wp roleManages user roles, including creating new roles and resetting to defaults.
wp scaffoldGenerates code for post types, taxonomies, plugins, child themes, etc.
wp search-replaceSearches/replaces strings in the database.
wp serverLaunches PHP’s built-in web server for a specific WordPress installation.
wp shellOpens an interactive PHP console for running and testing PHP code.
wp sidebarLists registered sidebars.
wp siteCreates, deletes, empties, moderates, and lists one or more sites on a multisite installation.
wp super-adminLists, adds, or removes super admin users on a multisite installation.
wp taxonomyRetrieves information about registered taxonomies.
wp termManages taxonomy terms and term meta, with create, delete, and list commands.
wp themeManages themes, including installs, activations, and updates.
wp transientAdds, gets, and deletes entries in the WordPress Transient Cache.
wp userManages users, along with their roles, capabilities, and meta.
wp widgetManages widgets, including adding and moving them within sidebars.

Leave a Comment