Title: MCOD Delete Media by Content
Author: Cristian Leguizamón
Published: <strong>March 5, 2026</strong>
Last modified: March 5, 2026

---

Search plugins

![](https://ps.w.org/mcod-bulk-delete-media-by-content/assets/banner-772x250.png?
rev=3475063)

![](https://ps.w.org/mcod-bulk-delete-media-by-content/assets/icon-256x256.png?rev
=3475063)

# MCOD Delete Media by Content

 By [Cristian Leguizamón](https://profiles.wordpress.org/crleguizamon/)

[Download](https://downloads.wordpress.org/plugin/mcod-bulk-delete-media-by-content.1.0.2.zip)

 * [Details](https://test.wordpress.org/plugins/mcod-bulk-delete-media-by-content/#description)
 * [Reviews](https://test.wordpress.org/plugins/mcod-bulk-delete-media-by-content/#reviews)
 *  [Installation](https://test.wordpress.org/plugins/mcod-bulk-delete-media-by-content/#installation)
 * [Development](https://test.wordpress.org/plugins/mcod-bulk-delete-media-by-content/#developers)

 [Support](https://wordpress.org/support/plugin/mcod-bulk-delete-media-by-content/)

## Description

**MCOD Delete Media by Content** allows you to **bulk delete WordPress media files**
attached to a specific post type. Whether you need to clean up orphaned images from
deleted WooCommerce products, remove PDFs tied to a custom post type, or purge an
unused media library section after a content migration, this plugin handles the 
process in batches.

Use it to **clean your WordPress media library** without touching media that is 
actively used elsewhere on your site based on your exclusions.

**Free Up Server Inodes:**
 Hosting servers have a limit on the number of files (
inodes) they can store, regardless of disk space. Each WordPress attachment generates
multiple thumbnail files, which rapidly consumes inodes. When the inode limit is
reached, no new files can be created on the server. This plugin **permanently deletes
media files and all their generated thumbnails** from the filesystem in batches,
helping to **reduce your inode count** and restore your server’s ability to handle
new uploads.

**Dual Detection Strategy:**
 This plugin uses a **dual detection strategy** to 
find media linked to your chosen post type by checking multiple fields: 1. **Direct
Parent:** Attachments whose `post_parent` points to a post of the selected type.
2. **Meta References:** Attachment IDs stored in postmeta — including **WooCommerce
product galleries** (`_product_image_gallery`), **ACF Image & Gallery fields**, **
featured images** saved as meta, and any other custom field referencing an attachment
ID.

This helps identify attachments properly without inadvertently affecting active 
media from other areas.

**Smart Cross-Type Exclusions — Protect Shared Media:**
 Before deleting, the plugin
cross-checks each attachment against other post types you select. If a product image
is also used as a featured image on a Page or referenced in a Post, it will be **
automatically skipped** — preventing broken images across your site.

**Key Features:**

 * **Bulk Delete by Post Type:** Target Products, Pages, Posts, or any registered
   custom post type.
 * **Media Type Filter:** Scope deletion to Images only, PDFs, Videos, Audio, or
   all attachments.
 * **Cross-Type Exclusions:** Protect attachments shared with other post types from
   accidental deletion.
 * **Preview Mode:** Count and preview a sample of media to be deleted (with direct
   edit links) before running.
 * **Safe Batch Processing:** Processes in configurable batches of 1–100 items to
   avoid PHP/server timeouts on large media libraries.
 * **Real-Time Progress Log:** Live status updates so you always know what is happening.
 * **WooCommerce & ACF Compatible:** Detects images in product galleries, ACF image/
   gallery fields, and other postmeta.
 * **Fully Translatable:** Internationalization-ready with a `.pot` file included.

⚠️ **This plugin permanently deletes media files from the database and the server
filesystem. Always create a full backup before running any deletion.**

## Installation

 1. Upload the `mcod-bulk-delete-media-by-content` folder to `/wp-content/plugins/`.
 2. Activate the plugin via the ‘Plugins’ menu in WordPress.
 3. Go to **Settings  Delete Media by Content**.
 4. Select the **Post Type** (source) and **Media Type**.
 5. (Optional) Select **Exclusions** (hold Ctrl/Cmd) to protect media shared with other
    content types.
 6. Click **Count Media** to see a preview of items to be deleted.
 7. Click **Start Deletion** to begin the cleanup process.

## FAQ

### Is this action reversible?

No. Media files are permanently deleted from the database and the server filesystem.**
Always back up your site** before using this plugin.

### What does “linked to a post type” mean?

The plugin finds attachments in two ways:
 1. **Direct:** The attachment’s `post_parent`
is a post of the selected type. 2. **Reference:** The attachment ID is found in 
the `postmeta` of the selected post type (e.g., WooCommerce product galleries, ACF
fields).

### Can I exclude images used in other pages?

Yes! Use the **“Exclude if also in”** field. Select the post types (e.g., Pages,
Posts) you want to cross-check. If an image is found in your source but also referenced
in an excluded type, it will NOT be deleted.

### Can I stop the process mid-way?

Yes. Click the **Stop** button to halt the process after the current batch finishes.

### What batch size should I use?

The default of 20 is safe for most servers. If your server is powerful, you can 
increase it up to 100. If you experience timeouts, lower it.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“MCOD Delete Media by Content” is open source software. The following people have
contributed to this plugin.

Contributors

 *   [ Cristian Leguizamﾃｳn ](https://profiles.wordpress.org/crleguizamon/)

[Translate “MCOD Delete Media by Content” into your language.](https://translate.wordpress.org/projects/wp-plugins/mcod-bulk-delete-media-by-content)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/mcod-bulk-delete-media-by-content/),
check out the [SVN repository](https://plugins.svn.wordpress.org/mcod-bulk-delete-media-by-content/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/mcod-bulk-delete-media-by-content/)
by [RSS](https://plugins.trac.wordpress.org/log/mcod-bulk-delete-media-by-content/?limit=100&mode=stop_on_copy&format=rss).

## Meta

 *  Version **1.0.2**
 *  Last updated **2 months ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 5.0 or higher **
 *  Tested up to **6.9.4**
 *  PHP version ** 7.4 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/mcod-bulk-delete-media-by-content/)
 * Tags
 * [attachment](https://test.wordpress.org/plugins/tags/attachment/)[bulk delete](https://test.wordpress.org/plugins/tags/bulk-delete/)
   [cleanup](https://test.wordpress.org/plugins/tags/cleanup/)[delete media](https://test.wordpress.org/plugins/tags/delete-media/)
   [media](https://test.wordpress.org/plugins/tags/media/)
 *  [Advanced View](https://test.wordpress.org/plugins/mcod-bulk-delete-media-by-content/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/mcod-bulk-delete-media-by-content/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/mcod-bulk-delete-media-by-content/reviews/)

## Contributors

 *   [ Cristian Leguizamﾃｳn ](https://profiles.wordpress.org/crleguizamon/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/mcod-bulk-delete-media-by-content/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](https://www.paypal.com/paypalme/cristian18josue)