This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

DX Delete Attached Media


DX Delete Attached Media deletes all of the attached media files to your posts once they get deleted from the system. The standard core behavior deletes posts alone without taking care of related images. Now you can maintain your install and get rid of all solo attachments getting into your posts via the Media button and used nowhere else.


  1. Upload ‘dx-delete-attached-media’ to the ‘/wp-content/plugins/’ directory or find via the Plugins admin section
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. That’s all. It would use out of the box, no settings needed. If you want to disable the functionality, disable the plugin from the Plugins section.


Does it work for custom post types?

Yes, as long as you attach images via the Media button, they are going to be deleted once the post/post type entry is deleted.

Does it work for all of the deleted posts?

It works for all of your deleted posts, as long as you delete them from the system. Keep in mind that the soft delete sends your post to Trash first, and deleting the media would happen once your Trash is being emptied.


Works great!

It works great with WP Job Manager too. I was lookig for a way to delete attachments when the custom post is deleted from the trash and it does that very well. Thanks!

Great plugin for removing images attached to custom posts via other plugins!

I was looking for a way to keep my server uncluttered for when a Buddypress member deletes an event (I use the Events Manager plugin), it leaves the multiple images that wordpress generates for each one uploaded on the server. I hate this behavior in general and how WordPress handles images in many ways. Since Events Manager uses custom post, this plugin works wonders for that job! Thank you for creating it!!

NOTE: I am using latest Buddypress and WordPress.

Wonderful, Works with Woocommerce

Tested with WordPress v4.3.1 and it works great. Deleted bunch of Woocommerce products and it automatically deleted all attached images on permanent delete. Saved lot of time.

Read all 13 reviews

Contributors & Developers

“DX Delete Attached Media” is open source software. The following people have contributed to this plugin.




  • Description update and version bump


  • First release