Global Header
,
15 Mins Read

WP-CLI Commands for Bluehost Cloud

Home Blog WordPress 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.

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 toGet 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 addAdds a new option with a specified value. Fails if the option already exists.
wp option deleteDeletes an existing option from the database.
wp option getRetrieves the value of a specified option.
wp option get-autoloadDisplays the autoload setting (yes or no) for a given option.
wp option listLists all options and their values, with optional filters.
wp option patchUpdates a nested value within a complex option (e.g., arrays or objects).
wp option pluckRetrieves a nested value from a complex option without modifying it.
wp option set-autoloadChanges the autoload behavior of an option (whether it loads on every page request).
wp option updateUpdates the value of an existing option or creates it if it doesn’t exist.
PLUGIN
wp plugin activateActivates one or more installed plugins.
wp plugin auto-updatesEnables, disables, or lists the auto-update status for plugins.
wp plugin deactivateDeactivates one or more active plugins.
wp plugin deleteDeletes plugin files without deactivating or uninstalling them.
wp plugin getRetrieves detailed information about a specific installed plugin.
wp plugin installInstalls one or more plugins from the WordPress.org repository or a local ZIP file.
wp plugin is-activeChecks whether a specific plugin is currently active.
wp plugin is-installedChecks whether a specific plugin is installed.
wp plugin listLists all installed plugins with details such as status, version, and update availability.
wp plugin pathDisplays the file path to a specific plugin or the plugin directory.
wp plugin searchSearches for plugins in the WordPress.org plugin repository.
wp plugin statusShows the activation status of one or all plugins.
wp plugin toggleToggles a plugin’s activation state—activates if inactive, deactivates if active.
wp plugin uninstallUninstalls one or more plugins, removing associated data.
wp plugin updateUpdates one or more plugins to the latest available version.
wp plugin verify-checksumsVerifies plugin files against checksums from WordPress.org to ensure file integrity.
POSTS
wp post createCreates a new post with specified parameters (e.g., title, content, post type).
wp post deleteDeletes an existing post by ID.
wp post editOpens the system editor to modify post content interactively.
wp post existsChecks whether a post with a given ID exists.
wp post generateGenerates dummy posts for testing or development purposes.
wp post getRetrieves detailed information about a specific post.
wp post listLists posts with optional filters (e.g., post type, status, author).
wp post metaManages post metadata—add, update, delete, or list custom fields.
wp post termAdds, updates, removes, or lists taxonomy terms (e.g., categories, tags) associated with a post.
wp post updateUpdates one or more fields of an existing post.
wp post url-to-idConverts a post URL into its corresponding post ID.
wp post-type getRetrieves details about a specific registered post type.
wp post-type listLists all registered post types in the WordPress installation.
REWRITE
wp rewriteManages WordPress rewrite rules and permalink settings. Useful for troubleshooting URL routing and refreshing permalink structures.
wp rewrite flushClears and regenerates the site’s rewrite rules. Often used after registering custom post types or taxonomies.
wp rewrite listDisplays the current set of rewrite rules used by WordPress.
wp rewrite structureUpdates the permalink structure (e.g., /blog/%postname%/) and flushes rewrite rules automatically.
DATABASE/PHP
wp shellOpens 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 activateActivates one or more previously deactivated sites.
wp site archiveArchives one or more sites, making them inaccessible to users.
wp site createCreates a new site within a multisite network.
wp site deactivateDeactivates one or more sites, preventing access without deleting them.
wp site deletePermanently deletes a site from the multisite network.
wp site emptyClears all content from a site—posts, comments, terms, and metadata—without deleting the site itself.
wp site listLists all sites in the multisite network with details such as ID, URL, and status.
wp site matureMarks one or more sites as “mature,” typically used for internal tracking.
wp site metaAdds, updates, deletes, or lists custom metadata fields for a site.
wp site optionManages site-specific options—add, update, delete, or list—within a multisite installation.
wp site privateSets one or more sites to private, restricting public access.
wp site publicSets one or more sites to public, making them accessible to visitors.
wp site spamFlags one or more sites as spam, often used for moderation or abuse control.
wp site switch-languageChanges the active language for a site.
wp site unarchiveRestores one or more archived sites to active status.
wp site unmatureRemoves the “mature” status from one or more sites.
wp site unspamRemoves the spam flag from one or more sites.
TAXONOMY, TERM
wp taxonomy getRetrieves detailed information about a registered taxonomy (e.g., categories, tags, or custom taxonomies).
wp taxonomy listLists all registered taxonomies in the WordPress installation.
wp term createCreates a new term within a specified taxonomy.
wp term deleteDeletes an existing term from a taxonomy.
wp term generateGenerates dummy terms for testing or development purposes.
wp term getRetrieves detailed information about a specific term.
wp term listLists all terms within a given taxonomy, with optional filters.
wp term metaManages term metadata—add, update, delete, or list custom fields.
wp term migrateMoves a term from one taxonomy to another.
wp term recountRecalculates the number of posts assigned to each term, useful after bulk content changes.
wp term updateUpdates the properties of an existing term (e.g., name, slug, description).
THEME
wp theme activateActivates a specified theme on the current site.
wp theme auto-updatesEnables, disables, or checks the status of automatic theme updates.
wp theme deleteDeletes one or more installed themes.
wp theme disableDisables a theme on a WordPress multisite network.
wp theme enableEnables a theme for use on a WordPress multisite network.
wp theme getRetrieves detailed information about a specific theme.
wp theme installInstalls one or more themes from WordPress.org or a ZIP file.
wp theme is-activeChecks whether a given theme is currently active.
wp theme is-installedVerifies if a theme is installed on the site.
wp theme listLists all installed themes with details such as status, version, and update availability.
wp theme modGets, sets, or removes theme modifications (theme-specific settings).
wp theme pathDisplays the file path to a specific theme or the theme directory.
wp theme searchSearches for themes in the WordPress.org theme repository.
wp theme statusShows the status of one or all installed themes (e.g., active, inactive, update available).
wp theme updateUpdates one or more themes to the latest version.
TRANSIENT
wp transient deleteDeletes a specified transient value from the database.
wp transient getRetrieves the value of a specified transient.
wp transient listLists all transients currently stored, along with their values and expiration times.
wp transient setSets a transient value with an optional expiration time.
wp transient typeIdentifies the type of transient implementation being used (e.g., database, object cache).
USER
wp user add-capAssigns a specific capability to a user.
wp user add-roleAdds an additional role to a user.
wp user application-passwordManages application passwords: create, update, delete, list, and retrieve.
wp user check-passwordVerifies if a user’s password is correct.
wp user createCreates a new user account.
wp user deleteDeletes one or more users from the current site.
wp user generateGenerates sample users for testing or development.
wp user getRetrieves detailed information about a user.
wp user import-csvImports users in bulk from a CSV file.
wp user listLists all users on the site.
wp user list-capsLists all capabilities for a user.
wp user metaAdds, updates, deletes, or lists user meta fields (custom data).
wp user remove-capRevokes a specific capability from a user.
wp user remove-roleRemoves a role from a user.
wp user reset passwordResets the password for one or more users.
wp user sessionLists or destroys active sessions for a user.
wp user set-roleSets the primary role for a user.
wp user spamFlags one or more users as spam.
wp user termManages user terms: add, update, remove, or list.
wp user unspamRemoves spam status from one or more users.
wp user updateUpdates an existing user’s information.
JETPACK
wp jetpack authorize_userAuthorizes a user via the command line and activates Jetpack for that user.
wp jetpack blockGenerates the essential files needed to build a Gutenberg block using Jetpack.
wp jetpack call_apiMakes a request to a WordPress.com API endpoint using the current site’s authentication token.
wp jetpack disconnectDisconnects Jetpack from blogs or users.
wp jetpack get_statsRetrieves site statistics via the WordPress.com API.
wp jetpack moduleEnables, disables, or lists Jetpack modules.
wp jetpack optionsManages Jetpack options and settings.
wp jetpack partner_cancelCancels the Jetpack plan provided by a partner, if applicable.
wp jetpack partner_provisionProvisions a site using a Jetpack Partner license.
wp jetpack protectConfigures Jetpack Protect settings for security.
wp jetpack publicizeManages Jetpack Publicize connections for social media sharing.
wp jetpack resetResets Jetpack settings and options to their default values.
wp jetpack scaffoldCreates starter files for building a Gutenberg block or Jetpack plugin.
wp jetpack sitemapManages the Jetpack-generated sitemap.
wp jetpack statusDisplays the current Jetpack connection and module status.
wp jetpack syncChecks the status of Jetpack sync or initiates a new sync process.
wp jetpack sync_queueLists the contents of a specific Jetpack sync queue.
wp jetpack test-connectionTests the active Jetpack connection to WordPress.com.
wp jetpack upload_ssh_credsUploads SSH credentials for backups, restores, and security scans.
DISK USAGE
wp disk-usageDisplays 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.

  • I'm Pawan, a content writer at Bluehost, specializing in WordPress. I enjoy breaking down technical topics to make them accessible. When I'm not writing, you'll find me lost in a good fiction book.

Learn more about Bluehost Editorial Guidelines
View All

Write A Comment

Your email address will not be published. Required fields are marked *

Longest running WordPress.org recommended host.

Get Up to 61% off on hosting for WordPress Websites and Stores.