Skip to main content

WP-CLI Commands for Bluehost Cloud and Advance Hosting Plans

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.

PASSWORD COMMANDS CommandTask
CACHING
wp cacheManages the WordPress Object Cache, allowing you to add, remove, retrieve, and flush cached data.
wp cache addAdds a specific value to the object cache.
wp cache deleteRemoves a specific value from the object cache.
wp cache flushClears all data from the object cache.
wp cache typeIdentifies the type of object cache currently in use.
wp capHandles 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 addAdds one or more capabilities to a specified user role.
wp cap listDisplays all capabilities assigned to a given role.
wp cap removeRemoves one or more capabilities from a specified user role.
wp super-admin addGrants super admin rights to one or more users.
wp super-admin listLists all users who currently have super admin privileges.
wp super-admin removeRevokes super admin rights from one or more users.
WP CLI
wp cliProvides tools to inspect and manage the WP-CLI environment, including updates, aliases, and internal configurations.
wp cli aliasRetrieves, sets, and updates aliases for WordPress installations to simplify command usage.
wp cli cacheManages WP-CLI’s internal cache for improved performance.
wp cli check-updateChecks if a newer version of WP-CLI is available.
wp cli cmd-dumpOutputs a list of all installed WP-CLI commands in JSON format.
wp cli completionsGenerates tab-completion strings for supported shells.
wp cli has-commandVerifies whether a specific WP-CLI command exists.
wp cli infoDisplays detailed information about the current WP-CLI environment, including version, PHP binary, and OS.
wp cli param-dumpOutputs a list of global parameters in JSON or var_export format.
wp cli updateUpdates WP-CLI to the latest stable release.
wp cli versionPrints the current version of WP-CLI installed.
WORDPRESS COMMENTS
wp commentProvides comprehensive tools to manage WordPress comments, including creation, moderation, deletion, and metadata handling.
wp comment approveApproves a pending comment.
wp comment countDisplays the number of comments on the entire site or a specific post.
wp comment createCreates a new comment programmatically.
wp comment deletePermanently deletes a comment.
wp comment existsChecks whether a comment with a given ID exists.
wp comment generateGenerates a specified number of dummy comments for testing purposes.
wp comment getRetrieves data for a specific comment.
wp comment listLists comments with optional filters.
wp comment metaManages custom fields (metadata) for comments—add, update, delete, or list.
wp comment recountRecalculates the comment_count value for one or more posts.
wp comment spamMarks a comment as spam.
wp comment statusDisplays the current status of a comment.
wp comment trashMoves a comment to the trash.
wp comment unapproveReverts a comment to unapproved status.
wp comment unspamRemoves the spam status from a comment.
wp comment untrashRestores a trashed comment.
wp comment updateUpdates one or more fields of an existing comment.
WP CORE
wp coreHandles essential operations for managing a WordPress installation, including downloading, installing, updating, and verifying core files.
wp core check-updateChecks for available WordPress updates using the Version Check API.
wp core downloadDownloads the latest WordPress core files.
wp core installExecutes the standard WordPress installation process.
wp core is-installedVerifies whether WordPress is already installed.
wp core multisite-convertConverts an existing single-site installation into a multisite network.
wp core multisite-installInstalls WordPress as a multisite network from scratch.
wp core updateUpdates WordPress to the latest available version.
wp core update-dbRuns the database upgrade routine after a core update.
wp core verify-checksumsValidates WordPress core files against checksums from WordPress.org to ensure file integrity.
wp core versionDisplays the currently installed WordPress version.
WP CRON
wp cronProvides tools to manage WordPress's scheduled tasks (WP-Cron), including testing, running, and deleting events, as well as viewing schedules.
wp cron eventchedules new WP-Cron events, runs existing ones manually, or deletes them.
wp cron scheduleLists all available WP-Cron schedules (e.g., hourly, daily, weekly).
wp cron testTests the WP-Cron spawning system and reports its current status to help diagnose issues.
DATABASE
wp dbPerforms 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 checkChecks the current status and integrity of the database.
wp db cleanRemoves all tables that use the $table_prefix defined in wp-config.php.
wp db cliOpens a MySQL command-line interface using the WordPress database credentials.
wp db columnsDisplays column information for a specified database table.
wp db createCreates a new database using the configured credentials.
wp db dropDeletes the existing database.
wp db exportExports the database to a file or outputs it to STDOUT.
wp db importImports a database from a file or STDIN.
wp db optimizeOptimizes all database tables to improve performance.
wp db prefixDisplays the current database table prefix.
wp db queryExecutes a raw SQL query against the database.
wp db repairRepairs corrupted database tables.
wp db resetRemoves all tables from the database, effectively resetting it.
wp db searchSearches for a specific string across the database.
wp db sizeDisplays the name and total size of the database.
wp db tablesLists all tables in the database.
EMBED
wp embedProvides tools to inspect oEmbed providers, manage embed caches, and handle embed-related functionality.
wp embed cacheFinds, triggers, and deletes cached oEmbed responses.
wp embed fetchAttempts to convert a given URL into embeddable HTML using oEmbed.
wp embed handlerRetrieves registered embed handlers used by WordPress to process specific types of content.
wp embed providerLists available oEmbed providers supported by WordPress.
EVAL
wp eval-fileLoads and executes a specified PHP file within the WordPress context. Useful for running scripts or performing batch operations.
wp evalExecutes arbitrary PHP code directly from the command line. Ideal for quick testing or debugging within the WordPress environment.
EXPORT/ IMPORT
wp exportGenerates 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 importImports 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 languageManages language packs for WordPress core, plugins, and themes—allowing you to install, activate, and update translations.
wp language coreInstalls, activates, and manages language packs for the WordPress core.
wp language pluginInstalls, activates, and manages language packs for plugins.
wp language themeInstalls, activates, and manages language packs for themes.
WORDPRESS MEDIA
wp mediaProvides tools to manage media files in WordPress, including importing attachments, fixing image orientation, regenerating thumbnails, and listing image sizes.
wp media fix-orientationCorrects the orientation of one or more image attachments based on EXIF data.
wp media importCreates media attachments from local file paths or remote URLs.
wp media image-sizeLists all image sizes registered with WordPress, including custom sizes.
wp media regenerateRegenerates thumbnails for one or more attachments, useful after changing image size settings.
WORDPRESS MENU/ SIDEBAR/ WIDGET
wp menu createCreates a new navigation menu.
wp menu deleteDeletes one or more existing menus.
wp menu itemLists, adds, or deletes items associated with a menu.
wp menu listDisplays a list of all registered menus.
wp menu locationAssigns, removes, or lists menu locations within the theme.
wp sidebar listLists all registered sidebars in the current theme.
wp widget addAdds a widget to a specified sidebar.
wp widget deactivateDeactivates one or more widgets from an active sidebar without deleting them.
wp widget deletePermanently removes one or more widgets from a sidebar.
wp widget listLists all widgets currently assigned to a sidebar.
wp widget moveChanges the position of a widget within a sidebar or moves it to another sidebar.
wp widget resetResets all sidebars by removing all widgets.
wp widget updateUpdates the settings/options of an existing widget.
NETWORK
wp network metaManages custom fields (metadata) associated with WordPress multisite networks. This command allows you to
  • Get metadata for a specific network.
  • Add new custom fields to a network.
  • Update existing metadata values.
  • Delete metadata entries.
  • List all metadata associated with a given network.

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.
PASSWORD COMMANDS
wp user update <user> --user_pass=<new_password> | Resetting a specific user's password directly
wp user update <user> --prompt=user_pass | Resetting a specific user's password with a prompt for security
wp user reset-password <user1> <user2> ... | Resetting a password for multiple users
|

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.