Using WP-CLI on your WordPress site

Using WP-CLI on your WordPress site

WP-CLI is a command-line tool for managing WordPress. Kapsule includes a WP-CLI console directly in KPanel, no SSH required.

Accessing the WP-CLI console

  1. Go to Websites and open your WordPress site
  2. In the sub-navigation, go to WordPress → Console

The console shows a prompt: wp , type your command after it and click Run (or press Enter).

Security note

KPanel's WP-CLI console runs commands as your site user and uses an allowlist. The following are blocked:

  • eval, arbitrary PHP execution
  • shell and shell-exec, direct shell commands
  • Destructive database commands

This is documented in the console itself: "Commands run as your site user via an allowlist. eval, shell, and destructive DB commands are blocked."

For unrestricted access, use SSH and run wp directly from your server.

Common commands

Managing plugins

wp plugin list                          # see all installed plugins
wp plugin update --all                  # update all plugins
wp plugin activate woocommerce          # activate a plugin
wp plugin deactivate contact-form-7     # deactivate a plugin

Managing users

wp user list                            # list all users
wp user create bob bob@example.com --role=editor
wp user update 1 --user_pass=newpassword

Database operations

wp search-replace 'old.domain.com' 'new.domain.com' --dry-run
wp search-replace 'old.domain.com' 'new.domain.com'
wp db optimize                          # optimise database tables

Always run --dry-run first to preview what search-replace will change.

Cache and maintenance

wp cache flush                          # clear object cache
wp cron event run --due-now             # run overdue cron jobs
wp transient delete --all               # delete all transients
wp rewrite flush                        # rebuild rewrite rules

WordPress core

wp core version                         # check current version
wp core update                          # update to latest WordPress
wp core verify-checksums                # verify core file integrity

When to use WP-CLI vs WordPress Quick Actions

TaskUse
Flush cacheEither (WordPress → Quick Actions is one click)
Update all pluginsEither (Quick Actions → Update Plugins)
Search and replace domainWP-CLI (Quick Actions doesn't do this)
Manage individual usersWP-CLI (more control than WP Admin)
Run specific cron jobsWP-CLI
Diagnose data issuesWP-CLI
Was this article helpful?

Still need help?

Our support team is here on business days, NZT.

Back to Help Centre