Sometimes we need to cleanup our sites a bit and delete old posts/pages or simply trash a new post that was just created.
Problem is that images and media files that were included in those trashed posts will still remain in the site’s Media Library, as long as you don’t delete them manually one by one!
Enters this wonderful free plugin: DX Delete Attached Media
Install, activate and forget it.
From now on, whenever a post or page with images is deleted, those images will also be permanently deleted for WordPress Media Library. Now you can maintain your install and get rid of all abandoned attachments getting into your posts via the Media button and used nowhere else.
Notes:
- This process will be effective only for posts published after the plugin’s activation.
Cleanup for media in posts published prior of this activation has to be performed manually. - Media files will deleted from Media Library only after the related post has been deleted and the post trash emptied.