Unveiling the Power of 50 Most Popular WP-CLI Commands

WordPress, the titan of content management systems, is celebrated not only for its intuitive UI but also for the robust functionality that it brings to users. For developers and system administrators who yearn for a more powerful interaction with the platform, WP-CLI (WordPress Command Line Interface) unveils a realm where tasks can be executed with finesse and speed using mere command lines. Today, we delve into 50 of the most popular WP-CLI commands, the silent architects behind streamlined WordPress management and development.

  1. WP Core Commands:
    • wp core download: Fetches the latest WordPress files without using a browser.
    • wp core install: Executes a basic WordPress installation, setting up URL, title, and login credentials.
    • wp core update: Updates WordPress to the latest version effortlessly.
    • wp core config: Generates a wp-config.php file.
    • wp core version: Retrieves the current WordPress version.
  2. WP Plugin Commands:
    • wp plugin install [plugin-name]: Installs a new plugin.
    • wp plugin activate [plugin-name]: Activates an installed plugin.
    • wp plugin deactivate [plugin-name]: Deactivates a plugin.
    • wp plugin update --all: Updates all installed plugins.
    • wp plugin delete [plugin-name]: Deletes a plugin.
  3. WP Theme Commands:
    • wp theme install [theme-name]: Installs a new theme.
    • wp theme activate [theme-name]: Activates a theme.
    • wp theme update --all: Updates all installed themes.
    • wp theme delete [theme-name]: Deletes a theme.
    • wp theme list: Lists all available themes.
  4. WP User Commands:
    • wp user create [username] [email]: Creates a new user.
    • wp user delete [username]: Deletes a user.
    • wp user list: Lists all users.
    • wp user update [username]: Updates user details.
    • wp user add-role [username] [role]: Adds a new role to a user.
  5. WP Post Commands:
    • wp post create: Creates a new post.
    • wp post update [id]: Updates a specific post.
    • wp post delete [id]: Deletes a specific post.
    • wp post list: Lists all posts.
    • wp post generate: Generates dummy posts for testing.
  6. WP Database Commands:
    • wp db export: Exports the WordPress database.
    • wp db import [file.sql]: Imports a database.
    • wp db optimize: Optimizes the WordPress database.
    • wp db repair: Repairs the database.
    • wp db query [sql-query]: Executes a custom SQL query.
  7. WP Media Commands:
    • wp media import [file-url]: Imports a media file.
    • wp media regenerate: Regenerates media file sizes.
    • wp media list: Lists all media files.
    • wp media delete [id]: Deletes a specific media file.
    • wp media image-size: Displays image sizes.
  8. WP Comment Commands:
    • wp comment create: Creates a new comment.
    • wp comment delete [comment-id]: Deletes a comment.
    • wp comment list: Lists all comments.
    • wp comment approve [comment-id]: Approves a comment.
    • wp comment spam [comment-id]: Marks a comment as spam.
  9. WP Cache Commands:
    • wp cache flush: Flushes the cache.
    • wp cache get [key] [group]: Retrieves a cached value.
    • wp cache set [key] [value] [group]: Sets a cache value.
    • wp cache type: Displays the cache type.
    • wp cache decrease [key] [offset] [group]: Decreases a cache value.
  10. WP Multisite Commands:
    • wp site create --slug=[slug]: Creates a new site within the network.
    • wp site list: Lists all the sites in the network.
    • wp site delete [id]: Deletes a site.
    • wp site empty: Empties a site of all posts and comments.
    • wp site private: Sets a site to private.


WP-CLI is the secret weapon that elevates the WordPress management experience, providing power and flexibility to developers, system admins, and anyone comfortable navigating through the command line. As we’ve traversed through the top 50 WP-CLI commands, it’s evident that tasks ranging from basic to advanced can be executed in mere seconds, fostering efficiency, precision, and more seamless WordPress management. So, gear up and utilize these commands to supercharge your WordPress endeavors with speed and expertise.

Note: Always ensure to have a backup of your WordPress site before using WP-CLI commands, especially those that modify the database or core files, to safeguard against any unforeseen mishaps.

Happy coding!

Leave a comment

No links of any kind allowed in comments - if you add any links, your comment will automatically be deleted.