=== DataPrune === Contributors: aireport Donate link: https://www.paypal.com/donate/?hosted_button_id=LSR9D3EA677KQ Tags: bulk delete, delete posts, delete media, scheduled delete, cleanup Requires at least: 5.8 Tested up to: 6.9 Requires PHP: 7.4 Stable tag: 1.2.2 License: GPL-2.0+ License URI: https://www.gnu.org/licenses/gpl-2.0.html Bulk-delete posts, pages, media, comments, users, taxonomy terms and metadata. Scheduled auto-deletion and recovery system included. == Description == **DataPrune** is a bulk-deletion and database-cleanup plugin for WordPress. It lets you remove any type of content β€” posts, pages, media, comments, users, taxonomy terms, and metadata β€” with precise filters and conditions, without ever risking a 503 timeout thanks to its **AJAX batch processing engine**. Whether you manage an automated content site (e.g. WP Automatic / ValvePress), a high-traffic blog, or a large e-commerce store, DataPrune gives you full control over what stays and what goes. = ✨ Key Features = **8 deletion modules, each with dedicated filters:** * πŸ“„ **Posts / Pages / CPT** β€” filter by status (published, draft, private, pending, scheduled…), date range, categories, tags, authors, post type. Option to also delete associated media in one click. * πŸ–ΌοΈ **Media & Attachments** β€” delete orphaned media (not linked to any post and not used as featured image), filter by MIME type, minimum file size, and upload date range. Protected media (site logo, favicon, header/background image) are never deleted. * πŸ” **Revisions** β€” delete all post revisions or only those older than a specific date range. * πŸ—‘οΈ **Trash** β€” permanently empty the WordPress trash, by content type. * πŸ’¬ **Comments** β€” delete spam, pending, approved or trashed comments with date filter. * πŸ‘€ **Users** β€” delete users by role, registration date, and activity (users with no published posts). Administrators and the currently logged-in user are always protected. * 🏷️ **Taxonomy Terms** β€” delete empty terms (no associated posts) for any taxonomy. * πŸ”‘ **Post Meta & User Meta** β€” delete metadata records by key and optional value. = ⏱️ Scheduled Auto-Deletion = Create automatic deletion tasks that run on a recurring schedule (hourly, twice daily, daily, weekly, monthly): * Choose deletion type, filters, and frequency * Enable/disable each task independently * Run any task manually on demand * Option to also delete associated media when auto-deleting posts * Ideal for sites that auto-publish content (WP Automatic, RSS importers, etc.) = ♻️ Recovery System = Every permanent deletion is saved in a dedicated database table before being executed: * **Visual grid** with thumbnail previews for media and posts * **Text search** by title * **Filters** by type (post/media), deletion date range, restoration status * **One-click restore** β€” posts are restored as drafts with all meta and taxonomy terms * Activity log with user, timestamp and item count for every operation = πŸ”’ Security Features = * **Safe mode (Trash)** β€” move items to trash instead of permanent deletion (recoverable) * **Confirmation dialog** β€” JavaScript confirmation before every bulk operation * **Protected media detection** β€” automatically excludes site logo, favicon, header image, background image, WooCommerce placeholder, and any media protected via the `wbdp_protected_media_ids` filter * **Admin protection** β€” administrators and the current user can never be deleted * **Nonce verification** on every request * **`manage_options` capability** check on every action * **Activity log** with configurable retention period = ⚑ No More 503 Timeout = All deletion operations use **AJAX batch processing**: the browser sends small batches of 50–100 items at a time, showing a real-time progress bar. No single request ever exceeds the server timeout, even with tens of thousands of items. = 🌐 Multilingual = * Default language: Italian * Full English (en_US) translation included * Ready for any language via standard `.po`/`.mo` files = 🀝 WP Automatic / ValvePress Integration = DataPrune is specifically optimized for sites using **WP Automatic by ValvePress**: * Auto-generated images are stored as WordPress attachments linked to posts * The "Delete associated media" option removes both the article and its generated image in a single operation * Orphaned images left by previously deleted articles are detected and cleaned up automatically * Scheduled tasks can be configured to delete posts + media on a recurring basis = ❀️ Support the Project = DataPrune is free and open-source software, released under the GPL v2 license. If it saves you time and keeps your database healthy, please consider making a small donation to support its continued development and maintenance. [Donate via PayPal](https://www.paypal.com/donate/?hosted_button_id=LSR9D3EA677KQ) == Installation == 1. Upload the `dataprune` folder to `/wp-content/plugins/` 2. Activate the plugin through the **Plugins** menu in WordPress 3. Navigate to **DataPrune** in the admin sidebar 4. Configure Security Settings before running your first deletion **Important:** After activation, go to **Settings** and verify: - βœ… Safe mode (Trash) is enabled for your first operations - βœ… Logging is enabled - βœ… Confirmation dialog is enabled == Frequently Asked Questions == = Will this plugin delete my site logo or favicon? = No. DataPrune automatically detects and protects the site logo (`custom_logo`), favicon (`site_icon`), header image, background image, and WooCommerce placeholder image. These are never treated as orphans. = Can I recover deleted items? = Yes, if the item was permanently deleted through this plugin. Before every permanent deletion, a snapshot of the item (all data, meta, and taxonomy terms) is saved to a dedicated recovery table. You can restore it from **DataPrune β†’ Recovery** as a draft. Note: if Safe mode (Trash) is active, items go to the WordPress trash and can be recovered from there directly. = Why use AJAX batch processing? = With thousands of items to delete, a single PHP request would exceed the server's `max_execution_time` (usually 30–60 seconds) and return a 503 error. Batch processing splits the work into small chunks of 50–100 items, each processed in a separate request, with a live progress bar. = Can I automatically delete old auto-generated posts? = Yes. Go to **DataPrune β†’ Scheduled** and create a new task: - Type: Posts / Pages - Status: Published (or any) - Older than: 30 days (or your preferred period) - βœ… Delete associated media - Frequency: Daily This will automatically delete posts and their images every day. = Is it compatible with WooCommerce? = Yes. You can delete products (custom post type `product`), WooCommerce-specific meta, and product terms. The WooCommerce placeholder image is always protected. = What WordPress version is required? = WordPress 5.8 or higher. PHP 7.4 or higher. = Is the plugin free? = Yes, completely free and open-source (GPL v2). If you find it useful, a small [donation](https://www.paypal.com/donate/?hosted_button_id=LSR9D3EA677KQ) helps cover development and maintenance costs. == Screenshots == 1. Dashboard β€” panoramica con stat card (post, media, spam, revisioni, cestino) e stream delle ultime attivitΓ  2. Elimina Contenuti β€” selettore dei tipi di contenuto con conteggi live e filtri avanzati 3. Modulo Media β€” rilevamento orfani, filtro MIME type, dimensione minima e intervallo di date 4. Automazione β€” lista task con stato, prossima esecuzione e form di creazione rapida 5. Recupero β€” griglia visuale con anteprime, ricerca, filtri e ripristino in un click 6. Barra di avanzamento AJAX β€” elaborazione batch in tempo reale, nessun timeout 503 7. Impostazioni di sicurezza β€” modalitΓ  cestino, conferma operazioni, log attivitΓ  == Changelog == = 1.2.1 = * Plugin renamed to DataPrune (slug: dataprune, text domain: dataprune) * Removed Plugin URI header (was identical to Author URI β€” WP.org requirement) * Updated description: removed comparative marketing language per WP.org guidelines = 1.2.2 = * Fix: i task programmati con "Mai eseguito" (next_run NULL) non venivano avviati automaticamente dalla cron giornaliera β€” la query ora include `OR next_run IS NULL` * Fix: errori PHP in run_single_batch() restituivano una risposta non valida al browser; aggiunto try/catch con messaggio di errore leggibile nel modal * New: barra di progresso animata durante l'esecuzione batch; il contatore mostra in tempo reale quanti elementi sono stati eliminati (es. "150 elementi eliminati") * New: in caso di errore, la barra diventa rossa e mostra il messaggio di errore effettivo invece del generico "Controlla il log" = 1.2.0 = * Fix CRITICO: il filtro "PiΓΉ vecchi di" nei task programmati veniva ignorato β€” tutti i contenuti corrispondenti al tipo/stato venivano eliminati indipendentemente dall'etΓ . I parametri older_than_value/older_than_unit ora vengono convertiti correttamente in datetime prima dell'esecuzione * Fix: aggiornamento immediato di next_run all'avvio di ogni invocazione cron β€” previene la doppia esecuzione del task da parte di run_due_tasks() mentre il cron chaining Γ¨ ancora attivo * Fix: il flag force_recovery ora viene correttamente gestito in delete_batch() β€” gli snapshot di recupero vengono salvati anche quando la modalitΓ  cestino Γ¨ attiva (per i task programmati) = 1.1.9 = * New: "Esegui ora" usa AJAX batch con progress modal β€” nessun timeout 503, elabora l'intero dataset senza ricaricare la pagina * New: Esecuzione automatica WP-Cron a catena β€” ogni invocazione elabora un batch, poi schedula automaticamente il successivo finchΓ© non rimangono elementi * New: Snapshot di recupero forzata per i task di tipo "Post" β€” possibilitΓ  di ripristino dalla pagina Recovery in caso di errore (non applicabile al task "Svuota Cestino") = 1.1.8 = * New: Filtro per categorie disponibile anche nel form dei task programmati (Automazione) * Fix: Errore 503 durante l'esecuzione manuale dei task programmati β€” aggiunto time-guard di 20 secondi per invocazione; se rimangono elementi, verranno eliminati alla successiva esecuzione = 1.1.7 = * New: Redesigned admin UI β€” Dashboard overview page with stat cards and activity stream; Bulk Delete page with content-type selector cards and live counts; Log page with stats header; Scheduled page with task card list * Fix: Added `phpcs:ignore` for inherent `DirectDatabaseQuery`/`NoCaching` in log, scheduler, recovery, comments, meta, posts, media classes (Plugin Check WARNINGs) * Fix: Added `phpcs:ignore` for `NonceVerification.Missing`/`Recommended` in admin page renderers β€” nonce is verified via `WBDP_Helper::verify_request()` (Plugin Check WARNING false positives) * Fix: Added `phpcs:ignore` for `PostNotIn_exclude` in delete-users class β€” user exclusion is inherently required for admin safety (Plugin Check WARNING false positive) * Fix: Added `NoCaching` suppression to `uninstall.php` DROP TABLE queries * Fix: Rewrote `WBDP_Recovery::count_items()` to use explicit if/else instead of ternary to resolve `NotPrepared` PHPCS ERROR * Fix: Removed `.DS_Store` files and `.gitignore` from plugin assets (Plugin Check ERROR β€” hidden_files) * Fix: Updated "Tested up to" to 6.9 in plugin header and readme (Plugin Check ERROR β€” outdated/mismatched header) = 1.1.5 = * Fix: Added `/* translators: */` comments to all i18n strings with placeholders (Plugin Check ERROR β€” WordPress.WP.I18n.MissingTranslatorsComment) * Fix: Replaced unordered `%s, %d` placeholders with ordered `%1$s, %2$d` in recovery success message (Plugin Check ERROR β€” WordPress.WP.I18n.UnorderedPlaceholders) * Fix: Wrapped `_n()` output in `esc_html()` in recovery page (Plugin Check ERROR β€” EscapeOutputDocumentedFunctions) * Fix: Removed all `.DS_Store` files from the plugin directory (Plugin Check ERROR β€” hidden_files) * Fix: Updated "Tested up to: 6.8" (Plugin Check ERROR β€” outdated WP version) * Fix: Replaced `date()` with `gmdate()` in helper, log, and scheduler classes (Plugin Check WARNING β€” WordPress.DateTime.RestrictedFunctions) * Fix: Added `wp_unslash()` before all `sanitize_*()` calls on `$_POST`/`$_GET` data (Plugin Check WARNING β€” WordPress.Security.ValidatedSanitizedInput.MissingUnslash) * Fix: Added `phpcs:disable WordPress.NamingConventions.PrefixAllGlobals` to all template files (local variables in included files) * Fix: Removed deprecated `load_plugin_textdomain()` call β€” WordPress auto-loads translations for WP.org plugins since 4.6 * Fix: Added `phpcs:ignore` for inherent DirectDatabaseQuery/SchemaChange in uninstall.php = 1.1.4 = * New: Donation page inside the plugin admin (DataPrune β†’ Donate) * New: `uninstall.php` β€” custom tables and options are now removed on plugin deletion (GPL/WP.org compliance) * Fix: `date()` replaced with `wp_date()` throughout β€” dates now respect WordPress timezone settings * Fix: HTML tags inside `esc_html_e()` in recovery page notes (tags were being escaped and shown as text) * Fix: Unescaped CSS class echoes in recovery grid template * Fix: Deprecated `get_users(['who'=>'authors'])` replaced with `capability` parameter (WP 5.9+) * Fix: Hardcoded Italian strings in admin.js moved to `wp_localize_script` for full i18n support * Fix: Admin CSS header updated; GPL-2.0+ license header added to all PHP/JS/CSS files * Fix: readme.txt β€” tags reduced to 5, short description shortened to ≀150 chars (WP.org validator) = 1.1.3 = * Fix: Fatal error on activation β€” activation/deactivation hooks moved to file scope (WordPress best practice) * Fix: Scheduler "revisions" and "trash" task types now use batch processing (previously called non-existent methods) = 1.1.2 = * Plugin renamed from WP Bulk Delete Pro to ExpirePress Delete (historical) = 1.1.1 = * Scheduled tasks: added "Delete associated media" option for post deletion tasks * Scheduler now uses batch processing (no timeout on large datasets) = 1.1.0 = * New: Recovery System β€” snapshot and restore permanently deleted items * New: Visual recovery grid with thumbnail previews * New: Search and filter in recovery page * Updated: Plugin metadata (Author: AiReport, Requires at least: 5.8, Requires PHP: 7.4) * Added: English (en_US) translations = 1.0.3 = * Fix: Protected media detection β€” site logo, favicon, header/background images are now excluded from orphan queries * New: `wbdp_protected_media_ids` filter for third-party extensions = 1.0.2 = * Fix: AJAX nonce field name mismatch causing `-1` response on media deletion = 1.0.1 = * New: Media tab with orphan detection, MIME type, size, and date range filters * New: AJAX batch processing with progress modal (solves 503 timeout on large datasets) * New: Date range filter (from/to) replacing the simple "older than" field * Updated: Tab slug for media changed to `media-files` = 1.0.0 = * Initial release * Bulk delete: posts, pages, CPT, revisions, trash, comments, users, taxonomy terms, post meta, user meta * Scheduled deletion with WP-Cron * Activity log * Security settings (trash mode, confirmation, log retention) * English translation == Upgrade Notice == = 1.2.1 = Plugin renamed to DataPrune. Update the plugin folder name to `dataprune` when upgrading manually. All data and settings are preserved. = 1.1.5 = Plugin Check compliance release: fixes all i18n ERRORs, removes .DS_Store files, replaces date() with gmdate(), adds wp_unslash() on all user inputs, updates "Tested up to: 6.8". Safe to update. = 1.1.4 = GPL/WP.org compliance release: adds uninstall cleanup, timezone fixes, i18n improvements, and a new Donation page. Safe to update. = 1.1.3 = Important fix for fatal error on activation. Re-upload the plugin folder and reactivate. All data and settings are preserved.