Skip to content

Instantly share code, notes, and snippets.

@phirebase
Last active January 8, 2025 23:40
Show Gist options
  • Save phirebase/4674ba5cf768bf70804c7c8b866c5cbe to your computer and use it in GitHub Desktop.
Save phirebase/4674ba5cf768bf70804c7c8b866c5cbe to your computer and use it in GitHub Desktop.
WP-CLI Quick Commands

WP-CLI Quick Commands

A collection of useful WP-CLI commands for managing your WordPress site effectively.

1️⃣ WordPress Core Management

Check WordPress version:

wp core version

Update WordPress:

wp core update

2️⃣ Plugin Management

List installed plugins:

wp plugin list

Update all plugins:

wp plugin update --all

Install and activate a plugin:

wp plugin install [plugin-name] --activate

3️⃣ Theme Management

List installed themes:

wp theme list

Activate a theme:

wp theme activate [theme-name]

Check inactive themes:

wp theme list --status=inactive

4️⃣ User Management

List all users:

wp user list

Create a new user:

wp user create [username] [email] --role=[role]

Reset a user’s password:

wp user update [username] --user_pass=[new-password]

5️⃣ Database Management

Export the database:

wp db export [filename].sql

Import a database:

wp db import [filename].sql

Optimize the database:

wp db optimize

6️⃣ Debugging and Testing

Check site status:

wp site status

Enable debugging:

wp config set WP_DEBUG true

List scheduled Cron jobs:

wp cron event list

7️⃣ Developer Tools

Generate a custom post type

wp scaffold post-type [post-type-name]

Generate a shortcode:

wp scaffold shortcode [shortcode-name]

Generate a new plugin:

wp scaffold plugin [plugin-name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment