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
- Go to Websites and open your WordPress site
- 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 executionshellandshell-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-runfirst to preview whatsearch-replacewill 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
| Task | Use |
|---|---|
| Flush cache | Either (WordPress → Quick Actions is one click) |
| Update all plugins | Either (Quick Actions → Update Plugins) |
| Search and replace domain | WP-CLI (Quick Actions doesn't do this) |
| Manage individual users | WP-CLI (more control than WP Admin) |
| Run specific cron jobs | WP-CLI |
| Diagnose data issues | WP-CLI |
Was this article helpful?
Back to Help Centre