Top 20 WP-CLI Commands Every WordPress Admin Should Know

Top 20 WP-CLI Commands Every WordPress Admin Should Know

Table of Contents

Managing a WordPress site via the dashboard is fine—until it’s not. When you’re dealing with multiple sites, broken plugins, or batch operations, the command line becomes your best friend. WP-CLI is the official WordPress command line tool and can save you hours of manual work.

Here are the top 20 WP-CLI commands every site admin or developer should know:


1. Check WordPress Version

wp core version

Quickly see what WordPress version your site is running.


2. Update WordPress Core

wp core update

Keeps your WordPress installation up to date.


3. Update All Plugins

wp plugin update --all

Bulk-update every plugin in one go.


4. Update All Themes

wp theme update --all

Useful for maintaining design consistency and security patches.


5. List Installed Plugins

wp plugin list

Outputs the status, version, and update availability of all plugins.


6. Activate or Deactivate Plugins

wp plugin activate plugin-slug
wp plugin deactivate plugin-slug

Quickly toggle plugin status without the dashboard.


7. Manage Users

wp user list

Lists all users, useful for identifying admins or locked accounts.

wp user create john [email protected] --role=editor --user_pass=123456

Creates a new user with specified role and password.


8. Reset User Password

wp user update john --user_pass=newpassword

Handy for account recovery or resetting forgotten passwords.


9. Export and Import the Database

wp db export
wp db import backup.sql

Backup or restore your site’s database effortlessly.


10. Search and Replace in the Database

wp search-replace 'http://oldsite.com' 'https://newsite.com'

Perfect for migrating domains or switching to HTTPS.


11. Clear All Caches (including object cache and plugins like W3 Total Cache)

wp cache flush

Forces WordPress to rebuild its internal caches.


12. Reinstall WordPress Core

wp core download --force

Re-download core files, useful for recovering corrupted installations.


13. Generate Dummy Content

wp post generate --count=10

Great for theme or plugin development and testing.


14. View Cron Jobs

wp cron event list

Inspect what’s scheduled to run and when.


15. Run a Cron Event Manually

wp cron event run --due-now

Force due cron jobs to run immediately.


16. Change Site URL

wp option update siteurl 'https://example.com'
wp option update home 'https://example.com'

Critical when updating domains or recovering broken sites.


17. Install and Activate a Theme

wp theme install neve --activate

Installs and switches to a new theme without touching the dashboard.


18. Debug Broken Plugins

wp plugin status

Shows active/inactive plugins; helpful when debugging site issues.


19. Check File Permissions

wp doctor check file-permissions

Use wp doctor (must be installed) to find common server misconfigurations.


20. Create a Full XML Export

wp export --dir=./exports

Creates a WordPress-compatible XML file for full site migration.


Bonus Tip: Make It Global

Install WP-CLI globally so it works across all your sites:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

Now just run wp from any project directory containing a wp-config.php.


Final Thoughts

WP-CLI is a powerhouse tool for any serious WordPress user. Whether you’re updating, troubleshooting, or deploying, this command-line utility gives you full control—faster and safer than clicking through the admin panel.

Make sure to always run commands in a staging environment first if you’re not sure of the outcome.

Stay productive—stay on the CLI.

Share :

Related Posts

Why Every Website Needs a Web Application Firewall

Why Every Website Needs a Web Application Firewall

If your website runs on WordPress, Joomla, or any open-source CMS, it’s a constant target for automated bots and malicious actors. Even fully updated platforms can be exploited via:

Read More
How to Use CIDI in WordPress

How to Use CIDI in WordPress

Integrating CI/CD with WordPress might sound overkill—but with CIDI (Continuous Integration & Deployment Infrastructure), it becomes a simple and effective way to:

Read More