The WP BAK Cleaner plugin provides a simple yet powerful tool to help keep your WordPress uploads directory tidy and secure. Many applications, especially image editors or backup tools, might leave behind `.bak` files (backup files) in your media library. Over time, these files can accumulate, consuming valuable disk space and potentially exposing unnecessary data.
This plugin allows you to:
* **Scan your entire uploads folder** for any files ending with `.bak` followed by an extension (e.g., `image.jpg.bak`, `document.pdf.bak`, `file.txt.bak`).
* **Perform a Dry Run** to see exactly which files would be deleted *before* actually deleting them, giving you full control and peace of mind.
* **Delete identified `.bak` files** with a single click, freeing up disk space and reducing clutter.
**Key Features:**
* **Simple Interface:** Accessible directly from the WordPress Tools menu.
* **Safe Deletion:** Includes a Dry Run option to preview deletions.
* **Performance-focused:** Efficiently scans large directories.
* **Secure:** Adheres to WordPress security best practices (nonces, capability checks).
* **Internationalized:** Ready for translation into multiple languages.
Keep your WordPress installation lean and clean with WP BAK Cleaner!
1. **Upload** the `wp-bak-cleaner` folder to the `/wp-content/plugins/` directory.
2. **Activate** the plugin through the ‘Plugins’ menu in WordPress.
3. Navigate to **Tools > BAK Cleaner** to access the plugin’s interface.
== Frequently Asked Questions ==
= What kind of files does this plugin delete? =
This plugin specifically targets files that end with `.bak.` followed by any file extension (e.g., `image.jpg.bak`, `document.pdf.bak`, `my-file.txt.bak`). It’s designed to remove leftover backup files that are often created by various software or processes.
= Is it safe to use the “Run Cleaner” option? =
The plugin includes a “Dry Run” option which we highly recommend using first. This will show you exactly which files would be deleted without actually removing them. Always ensure you have a recent backup of your WordPress site before performing any file deletion operations.
= What if I accidentally delete a file I needed? =
The plugin permanently deletes files. There is no “undo” button within the plugin itself. This is why the “Dry Run” option and regular site backups are strongly recommended.
= Does this plugin affect my actual media library entries? =
No, this plugin only deletes physical files on your server that match the `.bak` pattern. It does not interact with the WordPress media library database entries. Therefore, it will not break links to your active images or documents.
= 1.4 – 2025-07-18 =
* **Feature:** Expanded file detection to include *all* `.bak` files (e.g., `filename.bak.ext`), not just `.bak.jpg` or `.bak.png`.
* **Enhancement:** Updated plugin header for WordPress.org repository compliance (`Tested up to`, `Stable tag`).
* **Enhancement:** Added a warning message on the admin page regarding irreversible action.
* **Documentation:** Updated plugin description and text strings to reflect broader `.bak` file deletion.
= 1.3 – 2025-07-17 =
* Refactored plugin into an object-oriented structure for better maintainability and to prevent global namespace pollution.
* Implemented WordPress Nonces for enhanced security against CSRF attacks.
* Improved input sanitization and output escaping.
* Enhanced directory iteration with `RecursiveDirectoryIterator` flags for robustness.
* Added error logging for inaccessible directories or failed file deletions.
* Introduced internationalization support with `load_plugin_textdomain`.
* Updated PHP version requirement to 7.4.
= 1.2 – 2024-03-10 =
* Initial release with basic functionality to delete `.bak.jpg` and `.bak.png` files.
* Included Dry Run option.