WP-CLI » Delete inactive WordPress Plugins and Themes using WPCLI

Delete inactive WordPress Plugins and Themes using WPCLI

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
image - Delete inactive WordPress Plugins and Themes using WPCLI

Delete inactive WordPress themes:

wp theme delete $(wp theme list --status=inactive --field=name)
image 1 - Delete inactive WordPress Plugins and Themes using WPCLI

List inactive WordPress plugins:

wp plugin list --status=inactive
image 2 - Delete inactive WordPress Plugins and Themes using WPCLI

Delete inactive WordPress plugins:

wp plugin delete $(wp plugin list --status=inactive --field=name)
image 3 - Delete inactive WordPress Plugins and Themes using WPCLI
See also  How to display a Random 🔀 WordPress Post inside a Page

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended