How to Use WP-CLI via SSH
WP-CLI is a command-line tool for managing WordPress. It lets you update plugins, reset passwords, run database operations, and much more — all without using the WordPress admin panel.
Is WP-CLI available on TPC Hosting?
WP-CLI is pre-installed on all TPC Hosting shared and VPS plans. Connect via SSH and it is ready to use.
Basic usage
All WP-CLI commands start with wp and must be run from your WordPress installation directory:
- Connect to your server via SSH.
- Navigate to your WordPress folder:
cd public_html
(or the subdirectory where WordPress is installed, e.g. cd public_html/blog)
Common commands
- Check WordPress version:
wp core version
- Update WordPress core:
wp core update
- Update all plugins:
wp plugin update --all
- Update all themes:
wp theme update --all
- List all plugins and their status:
wp plugin list
- Activate a plugin:
wp plugin activate plugin-name
- Deactivate a plugin:
wp plugin deactivate plugin-name
- Reset a WordPress admin password:
wp user update admin --user_pass=NewPassword123
- Search and replace in the database (e.g. for domain migration):
wp search-replace 'https://olddomain.com' 'https://newdomain.com'
- Export the database:
wp db export backup.sql
- Import a database:
wp db import backup.sql
- Flush the rewrite rules (fix permalink issues):
wp rewrite flush
- Clear all transients (cached data):
wp transient delete --all
Tip: Add \--path=/home/username/public_html to run WP-CLI commands from any directory without navigating first.
Updated on: 28/04/2026
Thank you!