Deleting all inactive WordPress themes and plugins from your website is a recommended security practice. Even when deactivated, old, insecure plugins and themes might still pose a threat to the security of your WordPress website.
Here are oneliners to remove inactive themes and plugins from your WordPress website using WP-CLI.
List all inactive WordPress themes:
wp theme list --status=inactive
Delete inactive WordPress themes:
wp theme delete $(wp theme list --status=inactive --field=name)
List inactive WordPress plugins:
wp plugin list --status=inactive
Delete inactive WordPress plugins:
wp plugin delete $(wp plugin list --status=inactive --field=name)
Was this post helpful?
Let me know if you liked the post. That’s the only way I can improve. 🙂