WP-CLI Commands for Bluehost Cloud
WP-CLI (WordPress Command Line Interface) is a powerful tool that empowers developers and site administrators to manage WordPress installations directly from the command line. With WP-CLI Commands, you can perform a wide range of tasks—such as updating plugins, managing posts and users, configuring multisite setups, and more—without ever needing to log into the WordPress admin dashboard. By streamlining routine development and maintenance workflows, WP-CLI significantly boosts productivity and efficiency, making it an essential utility for anyone working with WordPress at scale.
Commonly Used WP-CLI Commands and Their Functions
To explore available options and syntax for any WP-CLI command, use the following format:
wp help <command>
For example, to view documentation for the db
command, simply type:
wp help db
This will display detailed information about the wp db
command, including its available subcommands, options, and usage examples. It's a quick and effective way to understand how each command works and how to use it properly.
Command | Task |
---|---|
CACHING | |
wp cache | Manages the WordPress Object Cache, allowing you to add, remove, retrieve, and flush cached data. |
wp cache add | Adds a specific value to the object cache. |
wp cache delete | Removes a specific value from the object cache. |
wp cache flush | Clears all data from the object cache. |
wp cache type | Identifies the type of object cache currently in use. |
wp cap |
Handles user role capabilities, enabling you to modify what each role can do. Add, remove, or list capabilities for a given user role to customize permissions and access levels. |
USER CAPABILITIES, ADMIN | |
wp cap add | Adds one or more capabilities to a specified user role. |
wp cap list | Displays all capabilities assigned to a given role. |
wp cap remove | Removes one or more capabilities from a specified user role. |
wp super-admin add | Grants super admin rights to one or more users. |
wp super-admin list | Lists all users who currently have super admin privileges. |
wp super-admin remove | Revokes super admin rights from one or more users. |
WP CLI | |
wp cli | Provides tools to inspect and manage the WP-CLI environment, including updates, aliases, and internal configurations. |
wp cli alias | Retrieves, sets, and updates aliases for WordPress installations to simplify command usage. |
wp cli cache | Manages WP-CLI’s internal cache for improved performance. |
wp cli check-update | Checks if a newer version of WP-CLI is available. |
wp cli cmd-dump | Outputs a list of all installed WP-CLI commands in JSON format. |
wp cli completions | Generates tab-completion strings for supported shells. |
wp cli has-command | Verifies whether a specific WP-CLI command exists. |
wp cli info | Displays detailed information about the current WP-CLI environment, including version, PHP binary, and OS. |
wp cli param-dump | Outputs a list of global parameters in JSON or var_export format. |
wp cli update | Updates WP-CLI to the latest stable release. |
wp cli version | Prints the current version of WP-CLI installed. |
WORDPRESS COMMENTS | |
wp comment | Provides comprehensive tools to manage WordPress comments, including creation, moderation, deletion, and metadata handling. |
wp comment approve | Approves a pending comment. |
wp comment count | Displays the number of comments on the entire site or a specific post. |
wp comment create | Creates a new comment programmatically. |
wp comment delete | Permanently deletes a comment. |
wp comment exists | Checks whether a comment with a given ID exists. |
wp comment generate | Generates a specified number of dummy comments for testing purposes. |
wp comment get | Retrieves data for a specific comment. |
wp comment list | Lists comments with optional filters. |
wp comment meta | Manages custom fields (metadata) for comments—add, update, delete, or list. |
wp comment recount | Recalculates the comment_count value for one or more posts. |
wp comment spam | Marks a comment as spam. |
wp comment status | Displays the current status of a comment. |
wp comment trash | Moves a comment to the trash. |
wp comment unapprove | Reverts a comment to unapproved status. |
wp comment unspam | Removes the spam status from a comment. |
wp comment untrash | Restores a trashed comment. |
wp comment update | Updates one or more fields of an existing comment. |
WP CORE | |
wp core | Handles essential operations for managing a WordPress installation, including downloading, installing, updating, and verifying core files. |
wp core check-update | Checks for available WordPress updates using the Version Check API. |
wp core download | Downloads the latest WordPress core files. |
wp core install | Executes the standard WordPress installation process. |
wp core is-installed | Verifies whether WordPress is already installed. |
wp core multisite-convert | Converts an existing single-site installation into a multisite network. |
wp core multisite-install | Installs WordPress as a multisite network from scratch. |
wp core update | Updates WordPress to the latest available version. |
wp core update-db | Runs the database upgrade routine after a core update. |
wp core verify-checksums | Validates WordPress core files against checksums from WordPress.org to ensure file integrity. |
wp core version | Displays the currently installed WordPress version. |
WP CRON | |
wp cron | Provides tools to manage WordPress's scheduled tasks (WP-Cron), including testing, running, and deleting events, as well as viewing schedules. |
wp cron event | chedules new WP-Cron events, runs existing ones manually, or deletes them. |
wp cron schedule | Lists all available WP-Cron schedules (e.g., hourly, daily, weekly). |
wp cron test | Tests the WP-Cron spawning system and reports its current status to help diagnose issues. |
DATABASE | |
wp db | Performs essential database operations using credentials defined in wp-config.php, allowing you to manage, inspect, and manipulate your WordPress database directly from the command line. |
wp db check | Checks the current status and integrity of the database. |
wp db clean | Removes all tables that use the $table_prefix defined in wp-config.php . |
wp db cli | Opens a MySQL command-line interface using the WordPress database credentials. |
wp db columns | Displays column information for a specified database table. |
wp db create | Creates a new database using the configured credentials. |
wp db drop | Deletes the existing database. |
wp db export | Exports the database to a file or outputs it to STDOUT. |
wp db import | Imports a database from a file or STDIN. |
wp db optimize | Optimizes all database tables to improve performance. |
wp db prefix | Displays the current database table prefix. |
wp db query | Executes a raw SQL query against the database. |
wp db repair | Repairs corrupted database tables. |
wp db reset | Removes all tables from the database, effectively resetting it. |
wp db search | Searches for a specific string across the database. |
wp db size | Displays the name and total size of the database. |
wp db tables | Lists all tables in the database. |
EMBED | |
wp embed | Provides tools to inspect oEmbed providers, manage embed caches, and handle embed-related functionality. |
wp embed cache | Finds, triggers, and deletes cached oEmbed responses. |
wp embed fetch | Attempts to convert a given URL into embeddable HTML using oEmbed. |
wp embed handler | Retrieves registered embed handlers used by WordPress to process specific types of content. |
wp embed provider | Lists available oEmbed providers supported by WordPress. |
EVAL | |
wp eval-file | Loads and executes a specified PHP file within the WordPress context. Useful for running scripts or performing batch operations. |
wp eval | Executes arbitrary PHP code directly from the command line. Ideal for quick testing or debugging within the WordPress environment. |
EXPORT/ IMPORT | |
wp export | Generates one or more WXR (WordPress eXtended RSS) files containing site content such as authors, terms, posts, comments, and attachments metadata. Note: WXR files do not include site configuration (options) or the actual attachment files. |
wp import | Imports content from a specified WXR file, allowing you to restore or migrate posts, pages, and other content types into a WordPress site. |
WORDPRESS LANGUAGE | |
wp language | Manages language packs for WordPress core, plugins, and themes—allowing you to install, activate, and update translations. |
wp language core | Installs, activates, and manages language packs for the WordPress core. |
wp language plugin | Installs, activates, and manages language packs for plugins. |
wp language theme | Installs, activates, and manages language packs for themes. |
WORDPRESS MEDIA | |
wp media | Provides tools to manage media files in WordPress, including importing attachments, fixing image orientation, regenerating thumbnails, and listing image sizes. |
wp media fix-orientation | Corrects the orientation of one or more image attachments based on EXIF data. |
wp media import | Creates media attachments from local file paths or remote URLs. |
wp media image-size | Lists all image sizes registered with WordPress, including custom sizes. |
wp media regenerate | Regenerates thumbnails for one or more attachments, useful after changing image size settings. |
WORDPRESS MENU/ SIDEBAR/ WIDGET | |
wp menu create | Creates a new navigation menu. |
wp menu delete | Deletes one or more existing menus. |
wp menu item | Lists, adds, or deletes items associated with a menu. |
wp menu list | Displays a list of all registered menus. |
wp menu location | Assigns, removes, or lists menu locations within the theme. |
wp sidebar list | Lists all registered sidebars in the current theme. |
wp widget add | Adds a widget to a specified sidebar. |
wp widget deactivate | Deactivates one or more widgets from an active sidebar without deleting them. |
wp widget delete | Permanently removes one or more widgets from a sidebar. |
wp widget list | Lists all widgets currently assigned to a sidebar. |
wp widget move | Changes the position of a widget within a sidebar or moves it to another sidebar. |
wp widget reset | Resets all sidebars by removing all widgets. |
wp widget update | Updates the settings/options of an existing widget. |
NETWORK | |
wp network meta |
Manages custom fields (metadata) associated with WordPress multisite networks. This command allows you to
|
WORDPRESS OPTIONS | |
wp option add | Adds a new option with a specified value. Fails if the option already exists. |
wp option delete | Deletes an existing option from the database. |
wp option get | Retrieves the value of a specified option. |
wp option get-autoload | Displays the autoload setting (yes or no ) for a given option. |
wp option list | Lists all options and their values, with optional filters. |
wp option patch | Updates a nested value within a complex option (e.g., arrays or objects). |
wp option pluck | Retrieves a nested value from a complex option without modifying it. |
wp option set-autoload | Changes the autoload behavior of an option (whether it loads on every page request). |
wp option update | Updates the value of an existing option or creates it if it doesn’t exist. |
PLUGIN | |
wp plugin activate | Activates one or more installed plugins. |
wp plugin auto-updates | Enables, disables, or lists the auto-update status for plugins. |
wp plugin deactivate | Deactivates one or more active plugins. |
wp plugin delete | Deletes plugin files without deactivating or uninstalling them. |
wp plugin get | Retrieves detailed information about a specific installed plugin. |
wp plugin install | Installs one or more plugins from the WordPress.org repository or a local ZIP file. |
wp plugin is-active | Checks whether a specific plugin is currently active. |
wp plugin is-installed | Checks whether a specific plugin is installed. |
wp plugin list | Lists all installed plugins with details such as status, version, and update availability. |
wp plugin path | Displays the file path to a specific plugin or the plugin directory. |
wp plugin search | Searches for plugins in the WordPress.org plugin repository. |
wp plugin status | Shows the activation status of one or all plugins. |
wp plugin toggle | Toggles a plugin’s activation state—activates if inactive, deactivates if active. |
wp plugin uninstall | Uninstalls one or more plugins, removing associated data. |
wp plugin update | Updates one or more plugins to the latest available version. |
wp plugin verify-checksums | Verifies plugin files against checksums from WordPress.org to ensure file integrity. |
POSTS | |
wp post create | Creates a new post with specified parameters (e.g., title, content, post type). |
wp post delete | Deletes an existing post by ID. |
wp post edit | Opens the system editor to modify post content interactively. |
wp post exists | Checks whether a post with a given ID exists. |
wp post generate | Generates dummy posts for testing or development purposes. |
wp post get | Retrieves detailed information about a specific post. |
wp post list | Lists posts with optional filters (e.g., post type, status, author). |
wp post meta | Manages post metadata—add, update, delete, or list custom fields. |
wp post term | Adds, updates, removes, or lists taxonomy terms (e.g., categories, tags) associated with a post. |
wp post update | Updates one or more fields of an existing post. |
wp post url-to-id | Converts a post URL into its corresponding post ID. |
wp post-type get | Retrieves details about a specific registered post type. |
wp post-type list | Lists all registered post types in the WordPress installation. |
REWRITE | |
wp rewrite | Manages WordPress rewrite rules and permalink settings. Useful for troubleshooting URL routing and refreshing permalink structures. |
wp rewrite flush | Clears and regenerates the site's rewrite rules. Often used after registering custom post types or taxonomies. |
wp rewrite list | Displays the current set of rewrite rules used by WordPress. |
wp rewrite structure | Updates the permalink structure (e.g., /blog/%postname%/ ) and flushes rewrite rules automatically. |
DATABASE/PHP | |
wp shell | Opens an interactive PHP console within the context of your WordPress installation. This allows you to run and test PHP code directly, making it a powerful tool for debugging, experimenting with WordPress functions, or inspecting data without modifying files Tip: deal for developers who want to interact with WordPress objects, functions, and APIs in real time. |
WEBSITE | |
wp site activate | Activates one or more previously deactivated sites. |
wp site archive | Archives one or more sites, making them inaccessible to users. |
wp site create | Creates a new site within a multisite network. |
wp site deactivate | Deactivates one or more sites, preventing access without deleting them. |
wp site delete | Permanently deletes a site from the multisite network. |
wp site empty | Clears all content from a site—posts, comments, terms, and metadata—without deleting the site itself. |
wp site list | Lists all sites in the multisite network with details such as ID, URL, and status. |
wp site mature | Marks one or more sites as “mature,” typically used for internal tracking. |
wp site meta | Adds, updates, deletes, or lists custom metadata fields for a site. |
wp site option | Manages site-specific options—add, update, delete, or list—within a multisite installation. |
wp site private | Sets one or more sites to private, restricting public access. |
wp site public | Sets one or more sites to public, making them accessible to visitors. |
wp site spam | Flags one or more sites as spam, often used for moderation or abuse control. |
wp site switch-language | Changes the active language for a site. |
wp site unarchive | Restores one or more archived sites to active status. |
wp site unmature | Removes the “mature” status from one or more sites. |
wp site unspam | Removes the spam flag from one or more sites. |
TAXONOMY, TERM | |
wp taxonomy get | Retrieves detailed information about a registered taxonomy (e.g., categories, tags, or custom taxonomies). |
wp taxonomy list | Lists all registered taxonomies in the WordPress installation. |
wp term create | Creates a new term within a specified taxonomy. |
wp term delete | Deletes an existing term from a taxonomy. |
wp term generate | Generates dummy terms for testing or development purposes. |
wp term get | Retrieves detailed information about a specific term. |
wp term list | Lists all terms within a given taxonomy, with optional filters. |
wp term meta | Manages term metadata—add, update, delete, or list custom fields. |
wp term migrate | Moves a term from one taxonomy to another. |
wp term recount | Recalculates the number of posts assigned to each term, useful after bulk content changes. |
wp term update | Updates the properties of an existing term (e.g., name, slug, description). |
THEME | |
wp theme activate | Activates a specified theme on the current site. |
wp theme auto-updates | Enables, disables, or checks the status of automatic theme updates. |
wp theme delete | Deletes one or more installed themes. |
wp theme disable | Disables a theme on a WordPress multisite network. |
wp theme enable | Enables a theme for use on a WordPress multisite network. |
wp theme get | Retrieves detailed information about a specific theme. |
wp theme install | Installs one or more themes from WordPress.org or a ZIP file. |
wp theme is-active | Checks whether a given theme is currently active. |
wp theme is-installed | Verifies if a theme is installed on the site. |
wp theme list | Lists all installed themes with details such as status, version, and update availability. |
wp theme mod | Gets, sets, or removes theme modifications (theme-specific settings). |
wp theme path | Displays the file path to a specific theme or the theme directory. |
wp theme search | Searches for themes in the WordPress.org theme repository. |
wp theme status | Shows the status of one or all installed themes (e.g., active, inactive, update available). |
wp theme update | Updates one or more themes to the latest version. |
TRANSIENT | |
wp transient delete | Deletes a specified transient value from the database. |
wp transient get | Retrieves the value of a specified transient. |
wp transient list | Lists all transients currently stored, along with their values and expiration times. |
wp transient set | Sets a transient value with an optional expiration time. |
wp transient type | Identifies the type of transient implementation being used (e.g., database, object cache). |
USER | |
wp user add-cap | Assigns a specific capability to a user. |
wp user add-role | Adds an additional role to a user. |
wp user application-password | Manages application passwords: create, update, delete, list, and retrieve. |
wp user check-password | Verifies if a user’s password is correct. |
wp user create | Creates a new user account. |
wp user delete | Deletes one or more users from the current site. |
wp user generate | Generates sample users for testing or development. |
wp user get | Retrieves detailed information about a user. |
wp user import-csv | Imports users in bulk from a CSV file. |
wp user list | Lists all users on the site. |
wp user list-caps | Lists all capabilities for a user. |
wp user meta | Adds, updates, deletes, or lists user meta fields (custom data). |
wp user remove-cap | Revokes a specific capability from a user. |
wp user remove-role | Removes a role from a user. |
wp user reset password | Resets the password for one or more users. |
wp user session | Lists or destroys active sessions for a user. |
wp user set-role | Sets the primary role for a user. |
wp user spam | Flags one or more users as spam. |
wp user term | Manages user terms: add, update, remove, or list. |
wp user unspam | Removes spam status from one or more users. |
wp user update | Updates an existing user’s information. |
JETPACK | |
wp jetpack authorize_user | Authorizes a user via the command line and activates Jetpack for that user. |
wp jetpack block | Generates the essential files needed to build a Gutenberg block using Jetpack. |
wp jetpack call_api | Makes a request to a WordPress.com API endpoint using the current site's authentication token. |
wp jetpack disconnect | Disconnects Jetpack from blogs or users. |
wp jetpack get_stats | Retrieves site statistics via the WordPress.com API. |
wp jetpack module | Enables, disables, or lists Jetpack modules. |
wp jetpack options | Manages Jetpack options and settings. |
wp jetpack partner_cancel | Cancels the Jetpack plan provided by a partner, if applicable. |
wp jetpack partner_provision | Provisions a site using a Jetpack Partner license. |
wp jetpack protect | Configures Jetpack Protect settings for security. |
wp jetpack publicize | Manages Jetpack Publicize connections for social media sharing. |
wp jetpack reset | Resets Jetpack settings and options to their default values. |
wp jetpack scaffold | Creates starter files for building a Gutenberg block or Jetpack plugin. |
wp jetpack sitemap | Manages the Jetpack-generated sitemap. |
wp jetpack status | Displays the current Jetpack connection and module status. |
wp jetpack sync | Checks the status of Jetpack sync or initiates a new sync process. |
wp jetpack sync_queue | Lists the contents of a specific Jetpack sync queue. |
wp jetpack test-connection | Tests the active Jetpack connection to WordPress.com. |
wp jetpack upload_ssh_creds | Uploads SSH credentials for backups, restores, and security scans. |
DISK USAGE | |
wp disk-usage | Displays disk usage statistics for the site's document root and temporary directories. Useful for monitoring storage consumption and identifying potential space issues. |
Summary
By leveraging the command line, users can execute operations quickly and efficiently—eliminating the need for time-consuming manual tasks. Whether you're a seasoned developer or a site manager, WP-CLI Commands significantly reduces the effort required for routine maintenance, user management, plugin control, and more. It empowers you to automate workflows, improve productivity, and maintain full control over your WordPress environment—all from the terminal.
If you need further assistance, feel free to contact us via Chat or Phone:
- Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
- Phone Support -
- US: 888-401-4678
- International: +1 801-765-9400
You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.