WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Polygon Themes v1.3.1

Autoremove Attachments

Remove child attachments when parent post, page or custom post type is deleted.

Autoremove Attachments

The facts

Rating
5★ from 15
Active installs
3k+
Price
Free
Last updated
10 May 2026
Added
Jul 2015
Requires WP
5.8
Tested up to
WP 6.9.7
Requires PHP
7.4
Downloads
38,518

Our analysis

AI-assisted

Autoremove Attachments is a WordPress plugin designed to help maintain a clean Media Library by automatically deleting media files that are child attachments when their parent post, page, or custom post type is deleted. This addresses the issue where WordPress retains unused media files after content removal, which can lead to orphaned files on the server.

The plugin only removes files that are tracked by WordPress and includes checks to ensure that attachments are not deleted if they are still in use elsewhere on the site. It is suitable for users who want to streamline their media management process, especially on sites with a large number of posts and media files.

Best for: This plugin is best for WordPress users who frequently delete posts and want to manage their media files efficiently.

What it does well

  • Automates deletion of child attachments
  • Helps keep Media Library clean
  • Prevents broken links by checking attachment usage
  • Can improve performance on large sites
  • Compatible with WooCommerce and Easy Digital Downloads

Where it falls short

  • Soft deletes do not trigger removal of attachments
  • Only removes files tracked by WordPress
  • Additional thumbnail sizes from poorly coded themes may remain

Verdict

Autoremove Attachments offers a practical solution for managing media files linked to deleted content, though it has some limitations regarding attachment tracking and soft deletes.

From the developer

Polygon Themes's own description of Autoremove Attachments, lightly tidied.

Autoremove Attachments helps you keep the Media Library clean by deleting all media files attached as child attachments to a post, page, or custom post type when the parent is deleted.

By default, when you delete content from your website, regardless if it’s a post, a page, a product, or any kind of post type, WordPress keeps the media files previously associated with it, even if after the removal of your content they are not used anywhere else.

Autoremove Attachments tries to solve this problem by automating the removal of all media files that have a child-parent relationship with the removed content. (so you don’t have to manually track and remove orphan files left on your server)

Important Considerations

  • A soft delete that places your post, page, or custom post type in Trash will not trigger the removal of its child attachments. The purge happens when you empty your trash.
  • When you delete a post, page or custom post type, we try to determine if its child attachments are used anywhere else on your website. If they are, we do not remove them, to prevent broken links.
  • The additional checks before the automatic removal can be disabled from the Media Settings for improved performance on large websites with thousands of posts and media files.
  • The plugin only removes files tracked by WordPress. Some poorly coded themes generate additional thumbnail sizes that are not tracked by WordPress and this always leads to orphan files left on your server.

Compatibility and Third-Party Support

If you use a plugin to optimize and clean your database of revisions, trashed posts, etc, make sure you use one that relies on native WordPress functions to perform the maintenance tasks. We recommend WP-Sweep.

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for custom content structures.

Ad Inserter

Manage Google AdSense ads, banners, ad rotation, sticky widgets, AMP ads, ads.txt, tracking, header and footer...

Free 300k+ installs 4.9★ (2,428)
Advanced Custom Fields

ACF helps customize WordPress with powerful, professional and intuitive fields. Proudly powering over 2 millio...

Free 2M+ installs 4.5★ (1,438)
Simple Custom Post Order

Easily reorder posts, pages, custom post types, and taxonomies with intuitive drag-and-drop sorting in the Wor...

Free 300k+ installs 4.8★ (569)
WP Activity Log

The #1 user-rated activity log plugin for event logging, activity monitoring and change tracking.

Free 300k+ installs 4.7★ (488)
Custom Post Type UI

Admin UI for creating custom content types like post types and taxonomies

Free 1M+ installs 4.6★ (276)