brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp theme delete with the all flag clears out unused WordPress themes

WordPress
~/tips/tip-wordpress-theme-delete-all-inactive

wp theme delete --all

Removes every theme except the active one, so old themes stop waiting for updates.

Every WordPress install collects themes nobody uses. They still get update notices, and an outdated one is still code on your server.

I’d look first, then delete:

wp theme list --status=inactive
wp theme delete --all

The first command shows what is installed but not in use. The second removes all of those in one go. --all skips the active theme on purpose, so the site keeps working. You can also name themes one by one, like wp theme delete twentytwentytwo twentytwentythree, which is what I’d do to keep one spare default theme around.

That spare is worth thinking about. WordPress falls back to a default theme when the active one breaks or disappears, and with nothing else installed you have no fallback at all. Keeping one recent Twenty-something theme costs almost nothing.

Watch out with child themes. If your active theme is a child theme, its parent shows up as inactive in the list, but the site needs it. Delete the parent and the front end breaks. Use the named form in that case and leave the parent alone. Deleting is permanent too: the files are gone, so a theme you edited by hand should be backed up first.

Further reading: wp theme delete, wp theme list

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp media image-size wp server --host=127.0.0.1 --port=8080 All WordPress tips (85) All topics

Link