A collection of useful WP-CLI commands for managing your WordPress site effectively.
Check WordPress version:
wp core versionUpdate WordPress:
wp core updateList installed plugins:
wp plugin listUpdate all plugins:
wp plugin update --allInstall and activate a plugin:
wp plugin install [plugin-name] --activateList installed themes:
wp theme listActivate a theme:
wp theme activate [theme-name]Check inactive themes:
wp theme list --status=inactiveList all users:
wp user listCreate a new user:
wp user create [username] [email] --role=[role]Reset a user’s password:
wp user update [username] --user_pass=[new-password]Export the database:
wp db export [filename].sqlImport a database:
wp db import [filename].sqlOptimize the database:
wp db optimizeCheck site status:
wp site statusEnable debugging:
wp config set WP_DEBUG trueList scheduled Cron jobs:
wp cron event listGenerate 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]