Skip to content

WP-CLI commands you actually use on cPanel — a practical cheatsheet

The WP-CLI commands that come up daily on a managed WordPress on cPanel — core, plugin, theme, user, database, and search-replace — with the flags that matter.

WP-CLI has a few hundred commands. You’ll use maybe twenty of them regularly. This is the list — the commands that come up daily on a managed WordPress fleet on cPanel, with the flags that actually matter.

What’s happening

WP-CLI groups commands by area: core, plugin, theme, user, db, option, transient, cron, search-replace, media, cache. Each group has subcommands. Most subcommands accept --format= (table, csv, json, count, ids), --dry-run for destructive ops, and --quiet for scripting.

How to verify

Confirm WP-CLI is reachable and the install:

wp --info
wp --version
wp core is-installed

If you got version info and core is-installed returned exit 0, you’re set.

The fix

Categorized by what you’re doing:

  1. Site info / health.

    wp core version
    wp core verify-checksums
    wp option get siteurl
    wp option get home
    wp option get admin_email
    wp db size --size_format=mb
  2. Plugins.

    wp plugin list --status=active --field=name
    wp plugin list --update=available
    wp plugin install <name> --activate
    wp plugin deactivate <name>
    wp plugin update --all
    wp plugin update <name> --version=1.2.3
    wp plugin delete <name>
  3. Themes. Same shape as plugins.

    wp theme list
    wp theme activate <name>
    wp theme install <name>
    wp theme update --all
  4. Users.

    wp user list --role=administrator
    wp user create newadmin admin@example.com --role=administrator --user_pass=$(openssl rand -base64 16)
    wp user reset-password <id>
    wp user delete <id> --reassign=<other_id>
    wp user session destroy --all <id>
  5. Database.

    wp db check
    wp db repair
    wp db optimize
    wp db export ~/backup.sql
    wp db import ~/backup.sql
    wp db query "SELECT COUNT(*) FROM wp_posts"
    wp db size --size_format=mb
  6. Search-replace (essential after migration or URL change).

    wp search-replace 'http://old.example.com' 'https://new.example.com' --all-tables --skip-columns=guid --dry-run
    wp search-replace 'http://old.example.com' 'https://new.example.com' --all-tables --skip-columns=guid

    Always --dry-run first. Always --skip-columns=guid.

  7. Options.

    wp option get <name>
    wp option update <name> <value>
    wp option set siteurl https://example.com
    wp option list --search=*_transient_*
    wp option delete <name>

    Bulk: list autoloaded options sorted by size:

    wp db query "SELECT option_name, LENGTH(option_value) AS size FROM wp_options WHERE autoload = 'yes' ORDER BY size DESC LIMIT 20"
  8. Transients.

    wp transient list
    wp transient delete --all
    wp transient delete <name>
  9. Cron.

    wp cron event list
    wp cron event list --due-now
    wp cron event run <hook>
    wp cron event delete <hook>
    wp cron test
  10. Maintenance mode.

    wp maintenance-mode activate
    wp maintenance-mode deactivate
    wp maintenance-mode status
  11. Media.

    wp media regenerate
    wp media import https://example.com/image.jpg --title="..."
  12. Cache (works with Redis Object Cache, etc.).

    wp cache flush
    wp redis status
    wp lscache-purge all
  13. Multisite.

    wp site list
    wp site create --slug=newsite --title="New Site"
    wp site empty <id>
    wp site delete <id>

Keep this open in a terminal tab. The investment in learning these saves hours every week. Stack Harbor manages WordPress sites primarily through WP-CLI under deployment management.

Stack Harbor operates production WordPress at scale — see enterprise WordPress operations for the managed model, or book a WordPress consult for a written read of your current shape.