Here are useful WP-CLI commands that I use when cleaning hacked WordPress websites in order to reinstall WP core, all themes, and plugins from WordPress.org
Reinstall WordPress core
wp core download --force --skip-content

💡 NOTE: You need to enable php-zip extension in order to extract the archive using WP-CLI. Also, make sure you enter the folder of your website before reinstalling WordPress.
Reinstall all plugins from WordPress.org
This one-liner will reinstall all free WordPress plugins from WordPress.org
wp plugin install $(wp plugin list --field=name) --force

wp plugin install $(wp plugin list --field=name) --force
Reinstall all themes from WordPress.org
This one-liner will reinstall all free WordPress themes from WordPress.org
wp theme install $(wp theme list --field=name) --force

Was this post helpful?
Let me know if you liked the post. That’s the only way I can improve. 🙂