---
title: "WP-CLI Cheat Sheet — A Quick Reference Guide for Using WP CLI like a Pro!"
date: 2022-12-16
author: "Shiv"
featured_image: "https://malcure.com/wp-content/uploads/2022/12/wp-cli-cheat-sheet-1.jpg"
categories:
  - name: "Code, CLI & Utilities"
    url: "/blog/utilities.md"
---

# WP-CLI Cheat Sheet — A Quick Reference Guide for Using WP CLI like a Pro!

![WP CLI CheatSheet](https://malcure.com/wp-content/uploads/2022/12/wp-cli-cheat-sheet-1.jpg)[WP-CLI](https://wp-cli.org/) is the command-line interface for WordPress which enables you to manage and maintain WordPress sites without using a web browser. There are commands to install plugins, activate theme, update WordPress core, [search and replace WordPress database](https://malcure.com/blog/utilities/using-regex-with-wp-cli-to-search-replace-in-the-database/), take a backup and the list goes on. WP CLI is a handy resource for the developers and it is also an effective tool for [fixing a hacked WordPress site](https://malcure.com/blog/security/10-steps-to-remove-malware-from-your-wordpress-site/).

Did you know Malcure Advanced Edition provides [WP-CLI integration](https://malcure.com/malware-removal-plugin/malcure-wp-cli-integration-cheatsheet/) out of the box? Manage automated scans, reports, definition syncs, definition imports/exports, async scan controls, and official checksum refreshes directly from the command line.

So let’s start with installing WP CLI.

## WP CLI Installation Guide

**Prerequisites:**

- UNIX-like environment (Linux, FreeBSD, OS X) (limited support in Windows environment)
- PHP 5.6 or later
- WordPress 3.7 or later (versions older than the latest WordPress release may have degraded functionality)

If you’re working in a restricted hosting environment, you can [download WP-CLI temporarily and optionally use it with a custom PHP version](https://malcure.com/blog/utilities/download-wp-cli-for-temporary-use-also-run-against-custom-php-version/).

**Step One: Download the wp-cli.phar file using curl:**

```
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
```

**Step Two: Verify that the PHAR file is working:**

```
php wp-cli.phar --info
```

**Step Three: Make wp-cli.phar executable:**

```
chmod +x wp-cli.phar
```

**Step Four: Rename wp-cli.phar to call is wp for ease of use**

```
sudo mv wp-cli.phar wp
```

**Step Five: Verify that wp command is working**

```
wp --info
```

If WP-CLI was installed successfully, you will see the following output:

```
OS:	Linux e43.ehosts.com 3.10.0-693.11.6.1.ELK.el6.x86_64 #1 SMP Tue Jan 23 10:30:30 MST 2018 x86_64
Shell:	/usr/local/cpanel/bin/jailshell
PHP binary:	/opt/cpanel/ea-php56/root/usr/bin/php
PHP version:	5.6.40
php.ini used:	/opt/cpanel/ea-php56/root/etc/php.ini
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/home2/me/public_html/cgi-bin
WP-CLI packages dir:	
WP-CLI global config:	
WP-CLI project config:	/home2/me/public_html/wp-cli.yml
WP-CLI version:	2.0.0
```

**Reference:** [Official WP CLI Installation Guide](https://wp-cli.org/#installing)

## WP CLI Commands — Usage Examples and Listing

Here are some of the WP CLI commands that I use most of time:

1. **Backing up WordPress Database:**```
    wp db export example-db.sql
    ```
    
    *replace example-db.sql with what you want to call your sql backup file*
    
    Want to run a quick malware scan? Try Malcure’s [Online Website Malware Scanner](https://malcure.com/malware-removal-plugin/webscan/) to check your site for malware and visible signs of compromise.
2. **Database Search and Replace:**```
    wp search-replace 'http://example.test' 'http://example.com'
    ```
    
    *replace http://example.test with old value and http://example.com with new value*  
    For advanced regex patterns, see our guide on [using regex with WP-CLI for search and replace in WordPress databases](https://malcure.com/blog/utilities/using-regex-with-wp-cli-to-search-replace-in-the-database/).
3. **Flush cache:**```
    wp cache flush
    ```
4. **Install and activate plugin:**```
    wp plugin install wp-malware-removal --activate
    ```
    
    This command installs and activates [Malcure Malware Shield](https://wordpress.org/plugins/wp-malware-removal/). Activating a valid license unlocks [Malcure Advanced Edition](https://malcure.com/malware-removal-plugin/).
5. **Flush / Refresh Permalink:**```
    wp rewrite flush
    ```

And here’s a complete list of WP CLI commands for managing WordPress via command-line interface:

### Cache

**`wp cache` commands for adding, removing, fetching, and flushing the WP Object Cache object**

CommandDescription[wp cache add](https://developer.wordpress.org/cli/commands/cache/add/)Adds a value to the object cache[wp cache decr](https://developer.wordpress.org/cli/commands/cache/decr/)Decrements a value in the object cache[wp cache delete](https://developer.wordpress.org/cli/commands/cache/delete/)Removes a value from the object cache[wp cache flush](https://developer.wordpress.org/cli/commands/cache/flush/)Flushes the object cache[wp cache get](https://developer.wordpress.org/cli/commands/cache/get/)Gets a value from the object cache[wp cache incr](https://developer.wordpress.org/cli/commands/cache/incr/)Increments a value in the object cache[wp cache replace](https://developer.wordpress.org/cli/commands/cache/replace/)Replaces a value in the object cache, if the value already exists[wp cache set](https://developer.wordpress.org/cli/commands/cache/set/)Sets a value to the object cache, regardless of whether it already exists[wp cache type](https://developer.wordpress.org/cli/commands/cache/type/)Attempts to determine which object cache is being used### Cap

**`wp cap` commands for adding, removing, and listing capabilities of a user role**

CommandDescription[wp cap add](https://developer.wordpress.org/cli/commands/cap/add/)Adds capabilities to a given role[wp cap list](https://developer.wordpress.org/cli/commands/cap/list/)Lists capabilities for a given role[wp cap remove](https://developer.wordpress.org/cli/commands/cap/remove/)Removes capabilities from a given role### CLI

**`wp cli` commands for reviewing current WP-CLI info, checking for updates, or viewing defined aliases**

CommandDescription[wp cli alias](https://developer.wordpress.org/cli/commands/cli/alias/)Retrieves, sets and updates aliases for WordPress Installations[wp cli cache](https://developer.wordpress.org/cli/commands/cli/cache/)Manages the internal WP-CLI cache[wp cli check-update](https://developer.wordpress.org/cli/commands/cli/check-update/)Checks to see if there is a newer version of WP-CLI available[wp cli cmd-dump](https://developer.wordpress.org/cli/commands/cli/cmd-dump/)Dumps the list of installed commands, as JSON[wp cli completions](https://developer.wordpress.org/cli/commands/cli/completions/)Generates tab completion strings[wp cli has-command](https://developer.wordpress.org/cli/commands/cli/has-command/)Detects if a command exists[wp cli info](https://developer.wordpress.org/cli/commands/cli/info/)Prints various details about the WP-CLI environment[wp cli param-dump](https://developer.wordpress.org/cli/commands/cli/param-dump/)Dumps the list of global parameters, as JSON or in var\_export format[wp cli update](https://developer.wordpress.org/cli/commands/cli/update/)Updates WP-CLI to the latest release[wp cli version](https://developer.wordpress.org/cli/commands/cli/version/)Prints WP-CLI version### Comment

**`wp comment` commands for creating, updating, deleting, and moderating comments**

CommandDescription[wp comment approve](https://developer.wordpress.org/cli/commands/comment/approve/)Approves a comment[wp comment count](https://developer.wordpress.org/cli/commands/comment/count/)Counts comments, on whole blog or on a given post[wp comment create](https://developer.wordpress.org/cli/commands/comment/create/)Creates a new comment[wp comment delete](https://developer.wordpress.org/cli/commands/comment/delete/)Deletes a comment[wp comment exists](https://developer.wordpress.org/cli/commands/comment/exists/)Verifies whether a comment exists[wp comment generate](https://developer.wordpress.org/cli/commands/comment/generate/)Generates some number of new dummy comments[wp comment get](https://developer.wordpress.org/cli/commands/comment/get/)Gets the data of a single comment[wp comment list](https://developer.wordpress.org/cli/commands/comment/list/)Gets a list of comments[wp comment meta](https://developer.wordpress.org/cli/commands/comment/meta/)Adds, updates, deletes, and lists comment custom fields[wp comment recount](https://developer.wordpress.org/cli/commands/comment/recount/)Recalculates the comment\_count value for one or more posts[wp comment spam](https://developer.wordpress.org/cli/commands/comment/spam/)Marks a comment as spam[wp comment status](https://developer.wordpress.org/cli/commands/comment/status/)Gets the status of a comment[wp comment trash](https://developer.wordpress.org/cli/commands/comment/trash/)Trashes a comment[wp comment unapprove](https://developer.wordpress.org/cli/commands/comment/unapprove/)Unapproves a comment[wp comment unspam](https://developer.wordpress.org/cli/commands/comment/unspam/)Unmarks a comment as spam[wp comment untrash](https://developer.wordpress.org/cli/commands/comment/untrash/)Untrashes a comment[wp comment update](https://developer.wordpress.org/cli/commands/comment/update/)Updates one or more comments### Config

**`wp config` commands for generating and reading the wp-config.php file**

CommandDescription[wp config create](https://developer.wordpress.org/cli/commands/config/create/)Generates a wp-config.php file[wp config delete](https://developer.wordpress.org/cli/commands/config/delete/)Deletes a specific constant or variable from the wp-config.php file[wp config edit](https://developer.wordpress.org/cli/commands/config/edit/)Launches system editor to edit the wp-config.php file[wp config get](https://developer.wordpress.org/cli/commands/config/get/)Gets the value of a specific constant or variable defined in wp-config.php file[wp config has](https://developer.wordpress.org/cli/commands/config/has/)Checks whether a specific constant or variable exists in the wp-config.php file[wp config list](https://developer.wordpress.org/cli/commands/config/list/)Lists variables, constants, and file includes defined in wp-config.php file[wp config path](https://developer.wordpress.org/cli/commands/config/path/)Gets the path to wp-config.php file[wp config set](https://developer.wordpress.org/cli/commands/config/set/)Sets the value of a specific constant or variable defined in wp-config.php file[wp config shuffle-salts](https://developer.wordpress.org/cli/commands/config/shuffle-salts/)Refreshes the salts defined in the wp-config.php file### Core

**`wp core` commands for downloading, installing, updating, and managing a WordPress installation**

If your WordPress core files are infected, you can reinstall them cleanly using WP-CLI. See our [step-by-step guide on reinstalling infected WordPress Core](https://malcure.com/blog/security/how-to-reinstall-infected-wordpress-core-using-wp-cli/).

CommandDescription[wp core check-update](https://developer.wordpress.org/cli/commands/core/check-update/)Checks for WordPress updates via Version Check API[wp core download](https://developer.wordpress.org/cli/commands/core/download/)Downloads core WordPress files[wp core install](https://developer.wordpress.org/cli/commands/core/install/)Runs the standard WordPress installation process[wp core is-installed](https://developer.wordpress.org/cli/commands/core/is-installed/)Checks if WordPress is installed[wp core multisite-convert](https://developer.wordpress.org/cli/commands/core/multisite-convert/)Transforms an existing single-site installation into a multisite installation[wp core multisite-install](https://developer.wordpress.org/cli/commands/core/multisite-install/)Installs WordPress multisite from scratch[wp core update](https://developer.wordpress.org/cli/commands/core/update/)Updates WordPress to a newer version[wp core update-db](https://developer.wordpress.org/cli/commands/core/update-db/)Runs the WordPress database update procedure[wp core verify-checksums](https://developer.wordpress.org/cli/commands/core/verify-checksums/)Verifies WordPress files against WordPress.org’s checksums[wp core version](https://developer.wordpress.org/cli/commands/core/version/)Displays the WordPress version### Cron

**`wp cron` commands for testing, running, and deleting WP-Cron events; managing WP-Cron schedules**

Example: You can automate Malcure scans from the command line. See Malcure’s [Automated Cron Scanning guide](https://malcure.com/malware-removal-plugin/deploy-malcure-web-hosting-cli-cron-automation/) to deploy WP-CLI-based malware scanning and reporting with cron in your web hosting environment.

CommandDescription[wp cron event](https://developer.wordpress.org/cli/commands/cron/event/)Schedules, runs, and deletes WP-Cron events[wp cron schedule](https://developer.wordpress.org/cli/commands/cron/schedule/)Gets WP-Cron schedules[wp cron test](https://developer.wordpress.org/cli/commands/cron/test/)Tests the WP Cron spawning system and reports back its status### Database

**`wp db` commands for performing basic database operations using credentials stored in wp-config.php**

Dealing with malware in large database exports? See our guide on [removing malware from large database dumps](https://malcure.com/blog/utilities/removing-malware-from-large-database-dumps/).

CommandDescription[wp db check](https://developer.wordpress.org/cli/commands/db/check/)Checks the current status of the database[wp db clean](https://developer.wordpress.org/cli/commands/db/clean/)Removes all tables with `$table\_prefix` from the database[wp db cli](https://developer.wordpress.org/cli/commands/db/cli/)Opens a MySQL console using credentials from wp-config.php[wp db columns](https://developer.wordpress.org/cli/commands/db/columns/)Displays information about a given table[wp db create](https://developer.wordpress.org/cli/commands/db/create/)Creates a new database[wp db drop](https://developer.wordpress.org/cli/commands/db/drop/)Deletes the existing database[wp db export](https://developer.wordpress.org/cli/commands/db/export/)Exports the database to a file or to STDOUT[wp db import](https://developer.wordpress.org/cli/commands/db/import/)Imports a database from a file or from STDIN[wp db optimize](https://developer.wordpress.org/cli/commands/db/optimize/)Optimizes the database[wp db prefix](https://developer.wordpress.org/cli/commands/db/prefix/)Displays the database table prefix[wp db query](https://developer.wordpress.org/cli/commands/db/query/)Executes a SQL query against the database[wp db repair](https://developer.wordpress.org/cli/commands/db/repair/)Repairs the database[wp db reset](https://developer.wordpress.org/cli/commands/db/reset/)Removes all tables from the database[wp db search](https://developer.wordpress.org/cli/commands/db/search/)Finds a string in the database[wp db size](https://developer.wordpress.org/cli/commands/db/size/)Displays the database name and size[wp db tables](https://developer.wordpress.org/cli/commands/db/tables/)Lists the database tables### Embeds

**`wp embed` commands for inspecting oEmbed providers, clearing embed cache, and more**

CommandDescription[wp embed cache](https://developer.wordpress.org/cli/commands/embed-2/cache/)Finds, triggers, and deletes oEmbed caches[wp embed fetch](https://developer.wordpress.org/cli/commands/embed-2/fetch/)Attempts to convert a URL into embed HTML[wp embed handler](https://developer.wordpress.org/cli/commands/embed-2/handler/)Retrieves embed handlers[wp embed provider](https://developer.wordpress.org/cli/commands/embed-2/provider/)Retrieves oEmbed providers### Language

**`wp language` commands for installing, activating, and managing language packs**

CommandDescription[wp language core](https://developer.wordpress.org/cli/commands/language/core/)Installs, activates, and manages core language packs[wp language plugin](https://developer.wordpress.org/cli/commands/language/plugin/)Installs, activates, and manages plugin language packs[wp language theme](https://developer.wordpress.org/cli/commands/language/theme/)Installs, activates, and manages theme language packs### Maintenance Mode

**`wp maintenance-mode` commands for activating, deactivating or checking the status of the maintenance mode of a site**

CommandDescription[wp maintenance-mode activate](https://developer.wordpress.org/cli/commands/maintenance-mode/activate/)Activates maintenance mode[wp maintenance-mode deactivate](https://developer.wordpress.org/cli/commands/maintenance-mode/deactivate/)Deactivates maintenance mode[wp maintenance-mode is-active](https://developer.wordpress.org/cli/commands/maintenance-mode/is-active/)Detects maintenance mode status[wp maintenance-mode status](https://developer.wordpress.org/cli/commands/maintenance-mode/status/)Displays maintenance mode status### Media

**`wp media` commands for importing files as attachments, regenerating thumbnails, or listing registered image sizes**

CommandDescription[wp media fix-orientation](https://developer.wordpress.org/cli/commands/media/fix-orientation/)Fix image orientation for one or more attachments[wp media image-size](https://developer.wordpress.org/cli/commands/media/image-size/)Lists image sizes registered with WordPress[wp media import](https://developer.wordpress.org/cli/commands/media/import/)Creates attachments from local files or URLs[wp media regenerate](https://developer.wordpress.org/cli/commands/media/regenerate/)Regenerates thumbnails for one or more attachments### Menu

**`wp menu` commands for listing, creating, assigning, and deleting the active theme’s navigation menus**

CommandDescription[wp menu create](https://developer.wordpress.org/cli/commands/menu/create/)Creates a new menu[wp menu delete](https://developer.wordpress.org/cli/commands/menu/delete/)Deletes one or more menus[wp menu item](https://developer.wordpress.org/cli/commands/menu/item/)List, add, and delete items associated with a menu[wp menu list](https://developer.wordpress.org/cli/commands/menu/list/)Gets a list of menus[wp menu location](https://developer.wordpress.org/cli/commands/menu/location/)Assigns, removes, and lists a menu’s locations### Network

**`wp network` commands for performing network-wide operations**

CommandDescription[wp network meta](https://developer.wordpress.org/cli/commands/network/meta/)Gets, adds, updates, deletes, and lists network custom fields.[wp network meta add](https://developer.wordpress.org/cli/commands/network/meta/add/)Add a meta field[wp network meta delete](https://developer.wordpress.org/cli/commands/network/meta/delete/)Delete a meta field[wp network meta get](https://developer.wordpress.org/cli/commands/network/meta/get/)Get meta field value[wp network meta list](https://developer.wordpress.org/cli/commands/network/meta/list/)List all metadata associated with an object[wp network meta patch](https://developer.wordpress.org/cli/commands/network/meta/patch/)Update a nested value for a meta field[wp network meta pluck](https://developer.wordpress.org/cli/commands/network/meta/pluck/)Get a nested value from a meta field[wp network meta update](https://developer.wordpress.org/cli/commands/network/meta/update/)Update a meta field### Option

**`wp option` commands for retrieving and setting site options, including plugin and WordPress settings**

CommandDescription[wp option add](https://developer.wordpress.org/cli/commands/option/add/)Adds a new option value[wp option delete](https://developer.wordpress.org/cli/commands/option/delete/)Deletes an option[wp option get](https://developer.wordpress.org/cli/commands/option/get/)Gets the value for an option[wp option list](https://developer.wordpress.org/cli/commands/option/list/)Lists options and their values[wp option patch](https://developer.wordpress.org/cli/commands/option/patch/)Updates a nested value in an option[wp option pluck](https://developer.wordpress.org/cli/commands/option/pluck/)Gets a nested value from an option[wp option update](https://developer.wordpress.org/cli/commands/option/update/)Updates an option value### Package

**`wp package` commands for listing, installing, and removing WP-CLI packages**

CommandDescription[wp package browse](https://developer.wordpress.org/cli/commands/package/browse/)Browses WP-CLI packages available for installation[wp package install](https://developer.wordpress.org/cli/commands/package/install/)Installs a WP-CLI package[wp package list](https://developer.wordpress.org/cli/commands/package/list/)Lists installed WP-CLI packages[wp package path](https://developer.wordpress.org/cli/commands/package/path/)Gets the path to an installed WP-CLI package, or the package directory[wp package uninstall](https://developer.wordpress.org/cli/commands/package/uninstall/)Uninstalls a WP-CLI package[wp package update](https://developer.wordpress.org/cli/commands/package/update/)Updates all installed WP-CLI packages to their latest version### Plugin

**`wp plugin` commands for managing plugins, including installs, activations, and updates**

Infected plugins can also be reinstalled cleanly via WP-CLI. Read our [guide on reinstalling infected WordPress Plugins using WP CLI](https://malcure.com/blog/security/batch-reinstalling-infected-wordpress-plugins-wp-cli/).

CommandDescription[wp plugin activate](https://developer.wordpress.org/cli/commands/plugin/activate/)Activates one or more plugins[wp plugin auto-updates](https://developer.wordpress.org/cli/commands/plugin/auto-updates/)Manages plugin auto-updates[wp plugin deactivate](https://developer.wordpress.org/cli/commands/plugin/deactivate/)Deactivates one or more plugins[wp plugin delete](https://developer.wordpress.org/cli/commands/plugin/delete/)Deletes plugin files without deactivating or uninstalling[wp plugin get](https://developer.wordpress.org/cli/commands/plugin/get/)Gets details about an installed plugin[wp plugin install](https://developer.wordpress.org/cli/commands/plugin/install/)Installs one or more plugins[wp plugin is-active](https://developer.wordpress.org/cli/commands/plugin/is-active/)Checks if a given plugin is active[wp plugin is-installed](https://developer.wordpress.org/cli/commands/plugin/is-installed/)Checks if a given plugin is installed[wp plugin list](https://developer.wordpress.org/cli/commands/plugin/list/)Gets a list of plugins[wp plugin path](https://developer.wordpress.org/cli/commands/plugin/path/)Gets the path to a plugin or to the plugin directory[wp plugin search](https://developer.wordpress.org/cli/commands/plugin/search/)Searches the WordPress.org plugin directory[wp plugin status](https://developer.wordpress.org/cli/commands/plugin/status/)Reveals the status of one or all plugins[wp plugin toggle](https://developer.wordpress.org/cli/commands/plugin/toggle/)Toggles a plugin’s activation state[wp plugin uninstall](https://developer.wordpress.org/cli/commands/plugin/uninstall/)Uninstalls one or more plugins[wp plugin update](https://developer.wordpress.org/cli/commands/plugin/update/)Updates one or more plugins[wp plugin verify-checksums](https://developer.wordpress.org/cli/commands/plugin/verify-checksums/)Verifies plugin files against WordPress.org’s checksums### Post

**`wp post` commands for managing posts, content, and meta**

CommandDescription[wp post create](https://developer.wordpress.org/cli/commands/post/create/)Creates a new post[wp post delete](https://developer.wordpress.org/cli/commands/post/delete/)Deletes an existing post[wp post edit](https://developer.wordpress.org/cli/commands/post/edit/)Launches system editor to edit post content[wp post exists](https://developer.wordpress.org/cli/commands/post/exists/)Verifies whether a post exists[wp post generate](https://developer.wordpress.org/cli/commands/post/generate/)Generates some posts[wp post get](https://developer.wordpress.org/cli/commands/post/get/)Gets details about a post[wp post list](https://developer.wordpress.org/cli/commands/post/list/)Gets a list of posts[wp post meta](https://developer.wordpress.org/cli/commands/post/meta/)Adds, updates, deletes, and lists post custom fields[wp post term](https://developer.wordpress.org/cli/commands/post/term/)Adds, updates, removes, and lists post terms[wp post update](https://developer.wordpress.org/cli/commands/post/update/)Updates one or more existing posts### Post Type

**`wp post-type` commands for retrieving details on the site’s registered post types**

CommandDescription[wp post-type get](https://developer.wordpress.org/cli/commands/post-type/get/)Gets details about a registered post type[wp post-type list](https://developer.wordpress.org/cli/commands/post-type/list/)Lists registered post types### Profile

**`wp profile` commands**

CommandDescription[wp profile eval](https://developer.wordpress.org/cli/commands/profile/eval/)Profile arbitrary code execution[wp profile eval-file](https://developer.wordpress.org/cli/commands/profile/eval-file/)Profile execution of an arbitrary file[wp profile hook](https://developer.wordpress.org/cli/commands/profile/hook/)Profile key metrics for WordPress hooks (actions and filters)[wp profile stage](https://developer.wordpress.org/cli/commands/profile/stage/)Profile each stage of the WordPress load process (bootstrap, main\_query, template)### Rewrite

**`wp profile` commands for listing or flushing the site’s rewrite rules, updating the permalink structure**

CommandDescription[wp rewrite flush](https://developer.wordpress.org/cli/commands/rewrite/flush/)Flushes rewrite rules[wp rewrite list](https://developer.wordpress.org/cli/commands/rewrite/list/)Gets a list of the current rewrite rules[wp rewrite structure](https://developer.wordpress.org/cli/commands/rewrite/structure/)Updates the permalink structure### Role

**`wp role` commands for managing user roles, including creating new roles and resetting to defaults**

CommandDescription[wp role create](https://developer.wordpress.org/cli/commands/role/create/)Creates a new role[wp role delete](https://developer.wordpress.org/cli/commands/role/delete/)Deletes an existing role[wp role exists](https://developer.wordpress.org/cli/commands/role/exists/)Checks if a role exists[wp role list](https://developer.wordpress.org/cli/commands/role/list/)Lists all roles[wp role reset](https://developer.wordpress.org/cli/commands/role/reset/)Resets any default role to default capabilities### Scaffold

**`wp scaffold` commands for generating code for post types, taxonomies, plugins, child themes, etc**

CommandDescription[wp scaffold block](https://developer.wordpress.org/cli/commands/scaffold/block/)Generates PHP, JS and CSS code for registering a Gutenberg block for a plugin or theme[wp scaffold child-theme](https://developer.wordpress.org/cli/commands/scaffold/child-theme/)Generates child theme based on an existing theme[wp scaffold plugin](https://developer.wordpress.org/cli/commands/scaffold/plugin/)Generates starter code for a plugin[wp scaffold plugin-tests](https://developer.wordpress.org/cli/commands/scaffold/plugin-tests/)Generates files needed for running PHPUnit tests in a plugin[wp scaffold post-type](https://developer.wordpress.org/cli/commands/scaffold/post-type/)Generates PHP code for registering a custom post type[wp scaffold taxonomy](https://developer.wordpress.org/cli/commands/scaffold/taxonomy/)Generates PHP code for registering a custom taxonomy[wp scaffold theme-tests](https://developer.wordpress.org/cli/commands/scaffold/theme-tests/)Generates files needed for running PHPUnit tests in a theme[wp scaffold underscores](https://developer.wordpress.org/cli/commands/scaffold/underscores/)Generates starter code for a theme based on \_s[wp scaffold \_s](https://developer.wordpress.org/cli/commands/scaffold/_s/)Generates starter code for a theme based on \_s### Sidebar

**`wp sidebar` commands for listing registered sidebars**

CommandDescription[wp sidebar list](https://developer.wordpress.org/cli/commands/sidebar/list/)Lists registered sidebars### Site

**`wp site` commands for creating, deleting, emptying, moderating, and listing one or more sites on a multisite installation**

CommandDescription[wp site activate](https://developer.wordpress.org/cli/commands/site/activate/)Activates one or more sites[wp site archive](https://developer.wordpress.org/cli/commands/site/archive/)Archives one or more sites[wp site create](https://developer.wordpress.org/cli/commands/site/create/)Creates a site in a multisite installation[wp site deactivate](https://developer.wordpress.org/cli/commands/site/deactivate/)Deactivates one or more sites[wp site delete](https://developer.wordpress.org/cli/commands/site/delete/)Deletes a site in a multisite installation[wp site empty](https://developer.wordpress.org/cli/commands/site/empty/)Empties a site of its content (posts, comments, terms, and meta)[wp site list](https://developer.wordpress.org/cli/commands/site/list/)Lists all sites in a multisite installation[wp site mature](https://developer.wordpress.org/cli/commands/site/mature/)Sets one or more sites as mature[wp site meta](https://developer.wordpress.org/cli/commands/site/meta/)Adds, updates, deletes, and lists site custom fields[wp site option](https://developer.wordpress.org/cli/commands/site/option/)Adds, updates, deletes, and lists site options in a multisite installation[wp site private](https://developer.wordpress.org/cli/commands/site/private/)Sets one or more sites as private[wp site public](https://developer.wordpress.org/cli/commands/site/public/)Sets one or more sites as public[wp site spam](https://developer.wordpress.org/cli/commands/site/spam/)Marks one or more sites as spam[wp site switch-language](https://developer.wordpress.org/cli/commands/site/switch-language/)Activates a given language[wp site unarchive](https://developer.wordpress.org/cli/commands/site/unarchive/)Unarchives one or more sites[wp site unmature](https://developer.wordpress.org/cli/commands/site/unmature/)Sets one or more sites as immature[wp site unspam](https://developer.wordpress.org/cli/commands/site/unspam/)Removes one or more sites from spam### Super Admin

**`wp super-admin` commands for listing, adding, or removing super admin users on a multisite installation**

CommandDescription[wp super-admin add](https://developer.wordpress.org/cli/commands/super-admin/add/)Grants super admin privileges to one or more users[wp super-admin list](https://developer.wordpress.org/cli/commands/super-admin/list/)Lists users with super admin capabilities[wp super-admin remove](https://developer.wordpress.org/cli/commands/super-admin/remove/)Removes super admin privileges from one or more users### Taxonomy

**`wp taxonomy` commands for retrieving information about registered taxonomies**

CommandDescription[wp taxonomy get](https://developer.wordpress.org/cli/commands/taxonomy/get/)Gets details about a registered taxonomy[wp taxonomy list](https://developer.wordpress.org/cli/commands/taxonomy/list/)Lists registered taxonomies### Term

**`wp term` commands for managing taxonomy terms and term meta, with create, delete, and list commands**

CommandDescription[wp term create](https://developer.wordpress.org/cli/commands/term/create/)Creates a new term[wp term delete](https://developer.wordpress.org/cli/commands/term/delete/)Deletes an existing term[wp term generate](https://developer.wordpress.org/cli/commands/term/generate/)Generates some terms[wp term get](https://developer.wordpress.org/cli/commands/term/get/)Gets details about a term[wp term list](https://developer.wordpress.org/cli/commands/term/list/)Lists terms in a taxonomy[wp term meta](https://developer.wordpress.org/cli/commands/term/meta/)Adds, updates, deletes, and lists term custom fields[wp term migrate](https://developer.wordpress.org/cli/commands/term/migrate/)Migrate a term of a taxonomy to another taxonomy[wp term recount](https://developer.wordpress.org/cli/commands/term/recount/)Recalculates number of posts assigned to each term[wp term update](https://developer.wordpress.org/cli/commands/term/update/)Updates an existing term### Theme

**`wp theme` commands for managing themes, including installs, activations, and updates**

CommandDescription[wp theme activate](https://developer.wordpress.org/cli/commands/theme/activate/)Activates a theme[wp theme auto-updates](https://developer.wordpress.org/cli/commands/theme/auto-updates/)Manages theme auto-updates[wp theme delete](https://developer.wordpress.org/cli/commands/theme/delete/)Deletes one or more themes[wp theme disable](https://developer.wordpress.org/cli/commands/theme/disable/)Disables a theme on a WordPress multisite install[wp theme enable](https://developer.wordpress.org/cli/commands/theme/enable/)Enables a theme on a WordPress multisite install[wp theme get](https://developer.wordpress.org/cli/commands/theme/get/)Gets details about a theme[wp theme install](https://developer.wordpress.org/cli/commands/theme/install/)Installs one or more themes[wp theme is-active](https://developer.wordpress.org/cli/commands/theme/is-active/)Checks if a given theme is active[wp theme is-installed](https://developer.wordpress.org/cli/commands/theme/is-installed/)Checks if a given theme is installed[wp theme list](https://developer.wordpress.org/cli/commands/theme/list/)Gets a list of themes[wp theme mod](https://developer.wordpress.org/cli/commands/theme/mod/)Sets, gets, and removes theme mods[wp theme path](https://developer.wordpress.org/cli/commands/theme/path/)Gets the path to a theme or to the theme directory[wp theme search](https://developer.wordpress.org/cli/commands/theme/search/)Searches the WordPress.org theme directory[wp theme status](https://developer.wordpress.org/cli/commands/theme/status/)Reveals the status of one or all themes[wp theme update](https://developer.wordpress.org/cli/commands/theme/update/)Updates one or more themes### Transient

**`wp transient` commands for adding, getting, and deleting entries in the WordPress Transient Cache**

CommandDescription[wp transient delete](https://developer.wordpress.org/cli/commands/transient/delete/)Deletes a transient value[wp transient get](https://developer.wordpress.org/cli/commands/transient/get/)Gets a transient value[wp transient list](https://developer.wordpress.org/cli/commands/transient/list/)Lists transients and their values[wp transient set](https://developer.wordpress.org/cli/commands/transient/set/)Sets a transient value[wp transient type](https://developer.wordpress.org/cli/commands/transient/type/)Determines the type of transients implementation### User

**`wp user` commands for managing users, along with their roles, capabilities, and meta**

CommandDescription[wp user add-cap](https://developer.wordpress.org/cli/commands/user/add-cap/)Adds a capability to a user[wp user add-role](https://developer.wordpress.org/cli/commands/user/add-role/)Adds a role for a user[wp user application-password](https://developer.wordpress.org/cli/commands/user/application-password/)Creates, updates, deletes, lists and retrieves application passwords[wp user check-password](https://developer.wordpress.org/cli/commands/user/check-password/)Checks if a user’s password is valid or not[wp user create](https://developer.wordpress.org/cli/commands/user/create/)Creates a new user[wp user delete](https://developer.wordpress.org/cli/commands/user/delete/)Deletes one or more users from the current site[wp user generate](https://developer.wordpress.org/cli/commands/user/generate/)Generates some users[wp user get](https://developer.wordpress.org/cli/commands/user/get/)Gets details about a user[wp user import-csv](https://developer.wordpress.org/cli/commands/user/import-csv/)Imports users from a CSV file[wp user list](https://developer.wordpress.org/cli/commands/user/list/)Lists users[wp user list-caps](https://developer.wordpress.org/cli/commands/user/list-caps/)Lists all capabilities for a user[wp user meta](https://developer.wordpress.org/cli/commands/user/meta/)Adds, updates, deletes, and lists user custom fields[wp user remove-cap](https://developer.wordpress.org/cli/commands/user/remove-cap/)Removes a user’s capability[wp user remove-role](https://developer.wordpress.org/cli/commands/user/remove-role/)Removes a user’s role[wp user reset-password](https://developer.wordpress.org/cli/commands/user/reset-password/)Resets the password for one or more users[wp user session](https://developer.wordpress.org/cli/commands/user/session/)Destroys and lists a user’s sessions[wp user set-role](https://developer.wordpress.org/cli/commands/user/set-role/)Sets the user role[wp user spam](https://developer.wordpress.org/cli/commands/user/spam/)Marks one or more users as spam[wp user term](https://developer.wordpress.org/cli/commands/user/term/)Adds, updates, removes, and lists user terms[wp user unspam](https://developer.wordpress.org/cli/commands/user/unspam/)Removes one or more users from spam[wp user update](https://developer.wordpress.org/cli/commands/user/update/)Updates an existing user### Widget

**`wp widget` commands for managing widgets, including adding and moving them within sidebars**

CommandDescription[wp widget add](https://developer.wordpress.org/cli/commands/widget/add/)Adds a widget to a sidebar[wp widget deactivate](https://developer.wordpress.org/cli/commands/widget/deactivate/)Deactivates one or more widgets from an active sidebar[wp widget delete](https://developer.wordpress.org/cli/commands/widget/delete/)Deletes one or more widgets from a sidebar[wp widget list](https://developer.wordpress.org/cli/commands/widget/list/)Lists widgets associated with a sidebar[wp widget move](https://developer.wordpress.org/cli/commands/widget/move/)Moves the position of a widget[wp widget reset](https://developer.wordpress.org/cli/commands/widget/reset/)Resets sidebar[wp widget update](https://developer.wordpress.org/cli/commands/widget/update/)Updates options for an existing widget### Internationalization

**`wp i18n` commands for providing internationalization tools for WordPress projects**

CommandDescription[wp i18n make-json](https://developer.wordpress.org/cli/commands/i18n/make-json/)Extract JavaScript strings from PO files and add them to individual JSON files[wp i18n make-mo](https://developer.wordpress.org/cli/commands/i18n/make-mo/)Create MO files from PO files[wp i18n make-pot](https://developer.wordpress.org/cli/commands/i18n/make-pot/)Create a POT file for a WordPress project[wp i18n update-po](https://developer.wordpress.org/cli/commands/i18n/update-po/)Update PO files from a POT file### Others

**WP CLI commands which do not have any subcommands**

CommandDescription[wp admin](https://developer.wordpress.org/cli/commands/admin/)Open /wp-admin/ in a browser[wp eval](https://developer.wordpress.org/cli/commands/eval/)Exports WordPress content to a WXR file[wp eval-file](https://developer.wordpress.org/cli/commands/eval-file/)Loads and executes a PHP file[wp import](https://developer.wordpress.org/cli/commands/import/)Imports content from a given WXR file[wp export](https://developer.wordpress.org/cli/commands/export/)Exports WordPress content to a WXR file[wp find](https://developer.wordpress.org/cli/commands/find/)Find WordPress installations on the filesystem[wp help](https://developer.wordpress.org/cli/commands/help/)Gets help on WP-CLI, or on a specific command[wp shell](https://developer.wordpress.org/cli/commands/shell/)Opens an interactive PHP console for running and testing PHP code[wp server](https://developer.wordpress.org/cli/commands/server/)Launches PHP’s built-in web server for a specific WordPress installation[wp search-replace](https://developer.wordpress.org/cli/commands/search-replace/)Searches/replaces strings in the database[wp dist-archive](https://developer.wordpress.org/cli/commands/dist-archive/)Create a distribution archive based on a project’s .distignore file