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://fa.wordpress.org/plugins/post-media-cleanup/#description)
 * [نقد و بررسی‌ها](https://fa.wordpress.org/plugins/post-media-cleanup/#reviews)
 *  [نصب](https://fa.wordpress.org/plugins/post-media-cleanup/#installation)
 * [توسعه](https://fa.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

## سوالات متداول

### 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.

## نقد و بررسی‌ها

نقد و بررسی‌ای برای این افزونه یافت نشد.

## توسعه دهندگان و همکاران

“Post Media Cleanup” نرم افزار متن باز است. افراد زیر در این افزونه مشارکت کرده‌اند.

مشارکت کنندگان

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

[ترجمه “Post Media Cleanup” به زبان شما.](https://translate.wordpress.org/projects/wp-plugins/post-media-cleanup)

### علاقه‌ مند به توسعه هستید؟

[کد را مرور کنید](https://plugins.trac.wordpress.org/browser/post-media-cleanup/)،
[مخزن SVN](https://plugins.svn.wordpress.org/post-media-cleanup/) را بررسی کنید،
یا از طریق [RSS](https://plugins.trac.wordpress.org/log/post-media-cleanup/?limit=100&mode=stop_on_copy&format=rss)
در [گزارش توسعه](https://plugins.trac.wordpress.org/log/post-media-cleanup/) مشترک
شوید.

## گزارش تغییرات

#### 1.0.0

 * Initial release

## اطلاعات

 *  نگارش **1.0.0**
 *  آخرین به‌روزرسانی **2 هفته پیش**
 *  نصب‌های فعال **کمتر از 10**
 *  نگارش وردپرس ** 5.0 یا بالاتر **
 *  آزمایش‌شده تا **7.0.2**
 *  نگارش PHP ** 7.4 یا بالاتر **
 *  زبان
 * [English (US)](https://wordpress.org/plugins/post-media-cleanup/)
 * برچسب
 * [attachments](https://fa.wordpress.org/plugins/tags/attachments/)[cleanup](https://fa.wordpress.org/plugins/tags/cleanup/)
   [delete](https://fa.wordpress.org/plugins/tags/delete/)[images](https://fa.wordpress.org/plugins/tags/images/)
   [media](https://fa.wordpress.org/plugins/tags/media/)
 *  [نمایش پیشرفته](https://fa.wordpress.org/plugins/post-media-cleanup/advanced/)

## امتیازها

هنوز هیچ نقدی ارسال نشده است.

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

[مشاهده همه بررسی‌ها](https://wordpress.org/support/plugin/post-media-cleanup/reviews/)

## مشارکت کنندگان

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

## پشتیبانی

چیزی برای گفتن دارید؟ نیاز به کمک دارید؟

 [مشاهده انجمن پشتیبانی](https://wordpress.org/support/plugin/post-media-cleanup/)