Title: Post Media Cleanup
Author: iftiarhossain
Published: <strong>Июль 13, 2026-ж.</strong>
Last modified: Июль 13, 2026-ж.

---

Плагиндерди издөө

![](https://ps.w.org/post-media-cleanup/assets/banner-772x250.png?rev=3617453)

![](https://ps.w.org/post-media-cleanup/assets/icon-256x256.png?rev=3617453)

# Post Media Cleanup

 Автору [iftiarhossain](https://profiles.wordpress.org/iftiarhossain/)

[Жүктөө](https://downloads.wordpress.org/plugin/post-media-cleanup.1.0.0.zip)

 * [Кенен маалымат](https://ky.wordpress.org/plugins/post-media-cleanup/#description)
 * [Сын-пикирлер](https://ky.wordpress.org/plugins/post-media-cleanup/#reviews)
 *  [Орнотуу](https://ky.wordpress.org/plugins/post-media-cleanup/#installation)
 * [Development](https://ky.wordpress.org/plugins/post-media-cleanup/#developers)

 [Колдоо](https://wordpress.org/support/plugin/post-media-cleanup/)

## Сүрөттөө

Post Media Cleanup removes orphaned media files from your server when you permanently
delete a post.

When you permanently delete a post, this plugin automatically finds and removes:

 * Featured image
 * Images and files embedded in post content
 * PDFs and any linked files in content
 * All attachments uploaded directly to the post

#### Key Features

 * Only fires on permanent deletion — moving to trash is always safe
 * Skip Shared Media — never deletes a file used by another post
 * Works per post type — configure exactly which types trigger cleanup
 * Compatible with S3 and cloud storage
 * Multisite ready
 * Developer friendly — filter hooks to extend behaviour

#### For Developers

Add extra attachments to the deletion list:

    ```
    add_filter( 'postmediaweb_attachment_ids_to_delete', function( $ids, $post_id ) {
        $extra = get_post_meta( $post_id, 'my_custom_pdf', true );
        if ( $extra ) $ids[] = (int) $extra;
        return $ids;
    }, 10, 2 );
    ```

Prevent a specific attachment from being deleted:

    ```
    add_filter( 'postmediaweb_should_delete_attachment', function( $should, $att_id, $post_id ) {
        if ( $att_id === 999 ) return false;
        return $should;
    }, 10, 3 );
    ```

## Орнотуу

 1. Upload the plugin folder to /wp-content/plugins/
 2. Activate through the Plugins screen
 3. Go to Settings  Post Media Cleanup to configure

## FAQ.KG

### Does it delete media when I move a post to trash?

No. Only permanent deletion triggers cleanup. Trash is always safe.

### What if the same image is used in two posts?

With Skip Shared Media enabled (default), the plugin checks before deleting. If 
the file is used elsewhere it is preserved.

### Does it work with WooCommerce products?

Yes. Enable Products in the Post Types setting.

### Does it work with S3 or cloud storage?

Yes. It uses wp_delete_attachment() which cloud storage plugins hook into automatically.

## Сын-пикирлер

There are no reviews for this plugin.

## Contributors & Developers

“Post Media Cleanup” is open source software. The following people have contributed
to this plugin.

Мүчөлөрү

 *   [ iftiarhossain ](https://profiles.wordpress.org/iftiarhossain/)

[Translate “Post Media Cleanup” into your language.](https://translate.wordpress.org/projects/wp-plugins/post-media-cleanup)

### Interested in development?

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

## Өзгөртүүлөр

#### 1.0.0

 * Initial release

## Мета

 *  Нуска **1.0.0**
 *  Акыркы жаңыртуу **1 ай мурун**
 *  Активдүү орнотуулар **Fewer than 10**
 *  WordPress нускасы ** 5.0 же андан жогору **
 *  Tested up to **7.0.4**
 *  PHP нускасы ** 7.4 же андан жогору **
 *  Тил
 * [English (US)](https://wordpress.org/plugins/post-media-cleanup/)
 * Тег:
 * [attachments](https://ky.wordpress.org/plugins/tags/attachments/)[cleanup](https://ky.wordpress.org/plugins/tags/cleanup/)
   [delete](https://ky.wordpress.org/plugins/tags/delete/)[images](https://ky.wordpress.org/plugins/tags/images/)
   [media](https://ky.wordpress.org/plugins/tags/media/)
 *  [Advanced View](https://ky.wordpress.org/plugins/post-media-cleanup/advanced/)

## Рейтинг

Азырынча эч кандай сын-пикир жок.

[Your review](https://wordpress.org/support/plugin/post-media-cleanup/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/post-media-cleanup/reviews/)

## Мүчөлөрү

 *   [ iftiarhossain ](https://profiles.wordpress.org/iftiarhossain/)

## Колдоо

Комментарийлер барбы? Жардам керекпи?

 [Колдоо форумун көрүү](https://wordpress.org/support/plugin/post-media-cleanup/)