Most Popular
Recently Added
Recently Updated

WordPress wp-cli (WordPress Command Line Interface)

How to use WordPress Command Line Interface

For help, type at command line: wp help
For example, wp help db export

Available commands:

    wp cache [add|add_global_groups|add_non_persistent_groups|decr|delete|flush|get|incr|replace|set|type]
    wp comment [create|delete|trash|untrash|spam|unspam|approve|unapprove|count|status|last]
    wp core [download|config|install|install_network|version|update|update_db]
    wp db [create|drop|reset|optimize|repair|connect|cli|query|export|import]
    wp eval-file
    wp eval
    wp export [validate_arguments]
    wp generate [posts|users]
    wp home
    wp option [add|update|delete|get]
    wp plugin [activate|deactivate|toggle|path|update|uninstall|delete|status|install]
    wp post-meta [get|delete|add|update]
    wp post [create|update|delete]
    wp theme [activate|path|delete|status|install|update]
    wp transient [get|set|delete|type]
    wp user-meta [get|delete|add|update]
    wp user [list|delete|create|update]
    wp super-cache [flush|status|enable|disable]

See 'wp help ' for more information on a specific command.

Available Commands Descrptions:

  • blog: Manages your blogs in a multisite installation.
  • cache: Manages your object cache.
  • cap: Manages all the capabilities of your users.
  • comments: Manages all your user comments.
  • core: Manages all the WordPress tasks like downloading, installing, updating etc.
  • db: Performs all your basic database operations.
  • eval: Executes the arbitrary PHP code after WordPress is loaded.
  • eval-file: Loads and executes PHP code after WordPress is loaded.
  • export: Exports your WordPress content to WXR file.
  • help: Provides help on various WordPress topics.
  • media: Controls your media library along with its attachments.
  • option: Manages your options in WordPress.
  • plugin: Manages your WordPress Plugins.
  • post: Manages all your WordPress Posts.
  • post-meta: Manages all your custom posts in WordPress.
  • rewrite: Manages the rules related to rewrite options.
  • roles: Manages the roles of your WordPress users.
  • scaffold: Generates the code for taxonomies and post types in your WordPress site.
  • search-replace: Searches and replaces the strings in your WordPress.
  • shell: Interactive console for PHP scripting.
  • term: Manages your WordPress terms.
  • theme: Manages your WordPress themes
  • transient: Manages all the transients in WordPress.
  • user: Manages all your site users.
  • user-meta: Manages the custom fields of your WordPress users.

Global parameters:

    --user=   set the current user
    --url=         set the current URL
    --path=       set the current path to the WP install
    --require=    load a certain file before running the command
    --quiet             suppress informational messages
    --version           print wp-cli version

Common Commands

  • Deactivate a plugin: wp plugin deactivate NAME or wp plugin toggle NAME
    • To deactivate on Multisite Network Installed plugins: wp plugin toggle NAME --network
  • Deactivate a theme: wp theme activate NAME (you have to actually activate a different theme)
  • Change a password:
    • wp user list (this will list all users, make a note of their IDs)
    • wp user update 3 --user_pass=123456 (changes the password to something you know)
  • Flush Cache: wp cache flush or wp super-cache flush (depending on which plugin they're using)
  • Re-update core: wp core update
  • Force the DB upgrade to run: wp core update-db

See the official WP CLI website at

Properties ID: 000151   Views: 4036   Updated: 9 years ago
Filed under: