=== Database Cleanup ===
Contributors: snehalpancholi
Tags: database, cleanup, performance, revisions, optimization
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Delete post revisions, auto-drafts, trashed posts, spam comments, transients, and orphaned meta with live counts and per-item confirmation.

== Description ==

Databases grow silently over time — post revisions, auto-saved drafts, spam comments, and expired transients accumulate until they noticeably slow down queries.

Database Cleanup gives you a single admin screen showing live counts for seven cleanup categories. Each item has its own Clean button with a confirmation dialog so you never accidentally delete the wrong thing.

**Cleanup categories**

* Post Revisions — saved copies of old post versions
* Auto-Drafts — editor auto-saves that were never published
* Trashed Posts — posts and pages in the trash
* Spam Comments — comments flagged as spam
* Trashed Comments — comments in the comment trash
* Expired Transients — temporary option rows left by plugins
* Orphaned Post Meta — meta rows whose parent post was deleted

**Features**

* Live row counts loaded via AJAX
* Per-item confirmation before deletion
* Batch processing (500 rows per click) to avoid timeouts
* Clean button disabled when count is already zero
* Works under Tools menu

== Installation ==

1. Upload the `database-cleanup` folder to `/wp-content/plugins/`.
2. Activate from **Plugins → Installed Plugins**.
3. Access the tool at **Tools → DB Cleanup**.

== Frequently Asked Questions ==

= Is this safe to use on a live site? =
Always take a database backup first. Deletions are permanent and cannot be undone from this plugin.

= Why does the count stay high after clicking Clean? =
Rows are deleted in batches of 500 to avoid server timeouts. Click Clean again until the count reaches zero.

= Will removing transients break my site? =
No. WordPress recreates any transient it needs. Removing expired ones frees up `wp_options` space.

== Changelog ==

= 1.0.0 =
* Initial release.

== Screenshots ==

1. Cleanup table showing live counts for each category with individual Clean buttons.
