Client Area

How to Use WP-CLI on Shared Hosting

3 min readPublished 26 Mar 2026Updated 23 Jun 2026155 views

In this article

  • 1Accessing WP-CLI
  • 2Via SSH
  • 3Via cPanel Terminal
  • 4Essential WP-CLI Commands
  • 5Check WordPress Status

How to Use WP-CLI on Shared Hosting

WP-CLI is the command-line interface for WordPress. It lets you manage WordPress without using the browser — update plugins, manage users, import/export content, and more.

Accessing WP-CLI

WP-CLI is pre-installed on Domain India shared hosting servers. Access it via SSH or the cPanel Terminal.

Via SSH

  1. Connect via SSH to your hosting account.
  2. Navigate to your WordPress directory:
bash
cd ~/public_html
  1. Run WP-CLI commands:
bash
wp --info

Via cPanel Terminal

  1. Log in to cPanel.
  2. Go to Advanced > Terminal.
  3. Navigate and run commands.

Essential WP-CLI Commands

Check WordPress Status

bash
wp core version          # Show WordPress version
wp core check-update     # Check for updates
wp --info                # Show WP-CLI and PHP info

Update WordPress

bash
wp core update           # Update WordPress core
wp core update-db        # Update database after core update

Plugin Management

bash
wp plugin list                    # List all plugins
wp plugin status                  # Show plugin statuses
wp plugin install akismet         # Install a plugin
wp plugin activate akismet        # Activate a plugin
wp plugin deactivate akismet      # Deactivate a plugin
wp plugin update --all            # Update all plugins
wp plugin delete old-plugin       # Delete a plugin

Theme Management

bash
wp theme list                     # List all themes
wp theme activate twentytwentyfour  # Activate a theme
wp theme update --all             # Update all themes

User Management

bash
wp user list                      # List all users
wp user create john [email protected] --role=editor  # Create user
wp user update 1 --user_pass=NewPassword123  # Reset password

Database Operations

bash
wp db optimize                    # Optimise database tables
wp db repair                      # Repair database
wp db export backup.sql           # Export database
wp db import backup.sql           # Import database
wp db search "old-text"           # Search in database
wp search-replace "old" "new"     # Search and replace in database

Cache Management

bash
wp cache flush                    # Flush object cache
wp transient delete --all         # Delete all transients
wp rewrite flush                  # Flush rewrite rules

Content Management

bash
wp post list                      # List posts
wp post delete 123 --force        # Delete a post
wp comment delete $(wp comment list --status=spam --format=ids) --force  # Delete all spam comments

Maintenance

bash
wp cron event list                # List scheduled cron events
wp cron event run --all           # Run all pending cron events
wp option get siteurl             # Check site URL
wp option update siteurl "https://yourdomain.com"  # Update site URL

Common Use Cases

Fix Locked Out of wp-admin

bash
wp user create tempadmin [email protected] --role=administrator --user_pass=TempPass123!

Log in with the temporary admin, fix the issue, then delete the temp user.

Fix White Screen of Death

bash
wp plugin deactivate --all        # Deactivate all plugins

Then reactivate one by one to find the problematic plugin.

Migrate Domain

bash
wp search-replace "https://old-domain.com" "https://new-domain.com"

Tip: WP-CLI is much faster than the WordPress admin for bulk operations like updating all plugins, cleaning spam comments, or running search-replace across the database.


Need help? Contact our support team at https://domainindia.com/support/client/support.

Was this article helpful?

Your feedback helps us improve our documentation

Still need help? Submit a support ticket