WP-CLI is the official command line tool for interacting with and managing your WordPress sites. Need help with something? Please review your available support options. Want to help make it better? WP-CLI can be used to manage WordPress plugins from the command line. This is useful for scripting or automating the management of your plugins. For example, with WP-CLI you could automatically check if there is an update for your plugins and upgrade them if there is a new version.
Below is a listing of all currently available WP-CLI commands with links to documentation on usage and subcommands.
- WP-CLI (WordPress Command Line Interface) is a powerful tool that can control every aspect of WordPress from the command line. When you’re tasked with updating or installing a plugin, managing multiple WordPress sites with the command line and scripting is more efficient.
- This is where the WordPress Command Line Interface (WP-CLI) comes in handy. The WP-CLI is a tool that enables you to interact with your WordPress site directly by using commands in a text-based interface. It’s also very comprehensive, featuring a wide variety of potential commands.
- Visit the WP-CLI homepage for more information, including installation instructions, available commands, and documentation, please.
Looking to learn more about the internal API of WP-CLI or to contribute to its development? Check out the WP-CLI team’s handbook.
Command | Description |
---|---|
wp admin | Open /wp-admin/ in a browser. |
wp cache | Adds, removes, fetches, and flushes the WP Object Cache object. |
wp cap | Adds, removes, and lists capabilities of a user role. |
wp cli | Reviews current WP-CLI info, checks for updates, or views defined aliases. |
wp comment | Creates, updates, deletes, and moderates comments. |
wp config | Generates and reads the wp-config.php file. |
wp core | Downloads, installs, updates, and manages a WordPress installation. |
wp cron | Tests, runs, and deletes WP-Cron events; manages WP-Cron schedules. |
wp db | Performs basic database operations using credentials stored in wp-config.php. |
wp dist-archive | Create a distribution archive based on a project’s .distignore file. |
wp embed | Inspects oEmbed providers, clears embed cache, and more. |
wp eval | Executes arbitrary PHP code. |
wp eval-file | Loads and executes a PHP file. |
wp export | Exports WordPress content to a WXR file. |
wp find | Find WordPress installations on the filesystem. |
wp help | Gets help on WP-CLI, or on a specific command. |
wp i18n | Provides internationalization tools for WordPress projects. |
wp import | Imports content from a given WXR file. |
wp language | Installs, activates, and manages language packs. |
wp maintenance-mode | Activates, deactivates or checks the status of the maintenance mode of a site. |
wp media | Imports files as attachments, regenerates thumbnails, or lists registered image sizes. |
wp menu | Lists, creates, assigns, and deletes the active theme’s navigation menus. |
wp network | Perform network-wide operations. |
wp option | Retrieves and sets site options, including plugin and WordPress settings. |
wp package | Lists, installs, and removes WP-CLI packages. |
wp plugin | Manages plugins, including installs, activations, and updates. |
wp post | Manages posts, content, and meta. |
wp post-type | Retrieves details on the site’s registered post types. |
wp profile | |
wp rewrite | Lists or flushes the site’s rewrite rules, updates the permalink structure. |
wp role | Manages user roles, including creating new roles and resetting to defaults. |
wp scaffold | Generates code for post types, taxonomies, plugins, child themes, etc. |
wp search-replace | Searches/replaces strings in the database. |
wp server | Launches PHP’s built-in web server for a specific WordPress installation. |
wp shell | Opens an interactive PHP console for running and testing PHP code. |
wp sidebar | Lists registered sidebars. |
wp site | Creates, deletes, empties, moderates, and lists one or more sites on a multisite installation. |
wp super-admin | Lists, adds, or removes super admin users on a multisite installation. |
wp taxonomy | Retrieves information about registered taxonomies. |
wp term | Manages taxonomy terms and term meta, with create, delete, and list commands. |
wp theme | Manages themes, including installs, activations, and updates. |
wp transient | Adds, gets, and deletes entries in the WordPress Transient Cache. |
wp user | Manages users, along with their roles, capabilities, and meta. |
wp widget | Manages widgets, including adding and moving them within sidebars. |
WP-CLI is a powerful and extensible way to interact with WordPress from the command line. WP-CLI is supported on VIP via our VIP-CLI tool.
Most of the things you can do with WordPress core have an equivalent command in WP-CLI. For example:
- Onboarding and offboarding users:
wp user create
,wp user delete
- List scheduled WP Cron tasks (asynchronous tasks in WordPress):
wp cron schedule list
- List all categories in your site:
wp term list category
If core does not have a command that meets your needs, you can also write your own custom WP-CLI command.
Resources
Wordpress Client Portal Plugin
- Installation and use: https://wp-cli.org/
- Handbook: https://make.wordpress.org/cli/handbook/
- Commands: https://developer.wordpress.org/cli/commands/
- Configuration: https://make.wordpress.org/cli/handbook/references/config/