YBO WooCommerce Media Cleaner

Overview

The YBO WooCommerce Media Cleaner was developed by YBO Digital for established WooCommerce stores that have accumulated large numbers of historic product images after products were discontinued and deleted.

Generic media-cleaning plugins often treat an unattached image as unused. On complex WordPress websites, that assumption is unsafe because images may still be used in Divi layouts, pages, posts, theme settings, featured images or other parts of the website even when they are no longer formally attached to a post.

The YBO WooCommerce Media Cleaner takes a deliberately conservative approach. It limits its investigation to recognisable S2S-style product-image filenames, checks for current WooCommerce, WordPress and Divi references, and then presents eligible files for visual human review before any deletion is allowed.

Why This Plugin Exists

Long-running WooCommerce stores can accumulate thousands of obsolete product images over time.

Deleted and Discontinued Products

When products are discontinued and removed from WooCommerce, their associated media files can remain in the WordPress Media Library and uploads directory.
Over several years, these unused files can consume substantial storage and make media management increasingly difficult.

Generic Media Cleaners Can Be Unsafe

Many media-cleaning tools rely heavily on whether an image is attached to a post or product.

This does not provide adequate protection for websites using Divi or other systems that may store image URLs and attachment references inside layouts, modules, metadata, theme options and reusable templates.
A legitimate page or post image can therefore be incorrectly classified as unused.

Large Media Libraries

Established online stores may contain tens of thousands of image attachments. Reviewing and deleting these files manually through the standard WordPress Media Library is impractical.

The YBO WooCommerce Media Cleaner provides a controlled audit, visual review and throttled deletion process designed for large media libraries.

How The Plugin Works

Step 1 – Identify Product-Image Candidates

The plugin reviews WordPress image attachments in controlled batches.

Only files matching the configured S2S-style product-image signature enter the candidate pool. Descriptively named website images are ignored and never become selectable for deletion.

The default signature recognises the distinctive 32-character hexadecimal filenames used by the product-image synchronisation process, including supported WordPress duplicate suffixes.

Step 2 – Build The Protected Reference Index

Each candidate is checked against supported WordPress, WooCommerce and Divi storage.

The plugin protects images referenced by:

  • WooCommerce product featured images
  • WooCommerce product galleries
  • Product variations
  • Product categories
  • Pages and posts
  • Featured images on other post types
  • Divi layouts and modules
  • Divi image and background URLs
  • WordPress post metadata
  • Term metadata
  • Theme and plugin options
  • User and comment metadata
  • Generated image sizes and scaled image variants

A reference to any generated size protects the original attachment and its related files.

Step 3 – Classify The Results

Images are separated into clear result groups:

  • Eligible for review
  • Protected by a WooCommerce reference
  • Protected by a WordPress or Divi reference
  • Requires review
  • Missing or otherwise unsuitable for automated deletion

The plugin fails closed. When a file or reference cannot be assessed safely, the image is protected rather than deleted.

Step 4 – Visual Human Review

Eligible results are displayed with prominent filenames and image thumbnails.

Administrators can:

  • Search by filename
  • Review image previews
  • Filter the result set
  • Select all eligible files server-side
  • Deselect individual exceptions
  • Export the audit results to CSV

The selection process is designed to handle thousands of images without sending an impractically large list of checkbox values through the browser.

Step 5 – Controlled Deletion Queue

Approved images are added to a permanent deletion queue.

Deletion takes place in small configurable batches with a delay between batches. This avoids placing excessive load on the WordPress database, file system or hosting environment.

Immediately before each attachment is removed, the plugin repeats the key reference and filename checks. If the image has acquired a new reference or its condition has changed, it is skipped and logged rather than deleted.

Synchronisation Methods

Scan Management

The plugin provides a visible scan-job controller showing queued, running, paused, completed, failed and cancelled scans.

Administrators can:
• View recent scan jobs
• Open an individual scan
• Monitor progress and the current scan stage
• Run the next batch manually when required
• Pause an active scan
• Resume from the saved position
• Cancel a scan

Browser-driven processing provides reliable progress while the Scan screen is open. WordPress Cron or WooCommerce Action Scheduler can continue processing as a backup where available.

Deletion Management

The deletion queue is separated from the scan and review stages so that nothing is removed automatically after a scan.
Administrators must deliberately review the eligible files, approve the selection and confirm permanent deletion.

The queue provides:
• Current progress
• Original workload
• Remaining selected files
• Deleted count
• Protected or skipped count
• Error reporting
• Pause and resume controls
• Cancellation
• Audit history

Deletion uses the standard WordPress attachment-deletion process rather than directly removing files from the server.

Safety Principles

The plugin is designed around the following safeguards:
• Descriptively named website media is ignored
• Only recognised product-image filename patterns enter the candidate pool
• Unattached does not automatically mean unused
• WooCommerce, WordPress and Divi references protect the image
• Generated sizes are mapped back to the original attachment
• Missing or ambiguous files are not deletable
• Shared physical file paths are protected
• Every file is revalidated immediately before deletion
• Human review is required
• Deletion runs in small delayed batches
• Scan and deletion jobs can be paused or cancelled
• All outcomes are logged

YBO Apps Integration

The plugin is available from the shared WordPress administration area:
YBO Apps → Media Cleaner

The tabbed interface separates the dashboard, scan jobs, review results, deletion queue, history and settings without creating long or cluttered administration screens.

Recommended Use

Before using the deletion function:
1. Create a verified backup of the WordPress database and uploads directory.
2. Install and test the plugin on a staging copy of the website.
3. Review the configured filename signature.
4. Run a complete scan.
5. Visually inspect the eligible filenames and thumbnails.
6. Export the audit report if required.
7. Begin with a small deletion selection.
8. Confirm that the website remains visually correct before processing a large queue.

Support

This plugin is a custom-developed solution by YBO Digital.

Project information, updates and support documentation:

YBO Woocommerce Media Cleaner

Support requests:
support@ybo.digital