=== Takahiro Revision Cleanup ===
Contributors: takahironishii
Tags: revision, cleanup, database, performance, delete revision
Requires at least: 5.9
Tested up to: 7.0
Stable tag: 1.3.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage and delete WordPress post revisions from a simple admin screen.

== Description ==

Takahiro Revision Cleanup helps site administrators review how many post revisions are stored in the database and remove them safely. It is a modern, secure replacement for abandoned plugins such as Better Delete Revision.

**Features**

* Overview of total revision count and estimated content size
* Paginated revision list (preview before delete)
* Breakdown by parent post type (posts, pages, custom post types, orphaned revisions)
* Delete all revisions or delete revisions for a single post type
* One-click continuous deletion with a live progress bar for large revision sets (falls back to standard form submits when JavaScript is unavailable)
* Lifetime counter of revisions removed
* Confirmation dialog before destructive actions
* CHECK TABLE and OPTIMIZE TABLE for `wp_posts` and `wp_postmeta` (safer than optimizing the entire database)
* Uses native `wp_delete_post_revision()` so post meta and term relationships are cleaned correctly
* NextGEN Gallery compatibility during batch deletes
* Security hardened for WordPress.org review: nonces, capability checks, prepared SQL, escaped output, per-user form tokens, rate limiting on destructive actions, strict DB table allowlist, batch size caps, and audit hooks

**Why this plugin**

Unlike older revision cleanup tools, this plugin focuses on a modern admin experience, granular deletion by post type, clear feedback after deletion, and WordPress coding standards compliance.

== Installation ==

1. Upload the `takahiro-revision-cleanup` folder to `/wp-content/plugins/`.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **Tools > Takahiro Revision Cleanup** to review and delete revisions.

== Frequently Asked Questions ==

= Will this delete my published posts? =

No. Only posts with the `revision` post type are removed. Published content is not affected.

= How is this different from Better Delete Revision? =

Better Delete Revision was closed on WordPress.org in 2022 due to security issues. Takahiro Revision Cleanup provides the same core workflow (review revisions, delete them, check/optimize tables) plus post-type filtering, pagination, lifetime stats, and modern security practices.

= Can I undo a deletion? =

No. Deleted revisions cannot be restored unless you have a database backup.

= Does it work on multisite? =

Multisite support is not included in version 1.2.

== Screenshots ==

1. Revision overview and delete actions

== Changelog ==

= 1.3.0 =
* Add one-click continuous deletion with a live progress bar via AJAX (batches of 200); no more repeated reloads on large sites
* Gracefully fall back to standard form submits when JavaScript is disabled
* Restore Plugin URI header pointing to the plugin's dedicated page (distinct from Author URI)

= 1.2.1 =
* Remove Plugin URI header (must differ from Author URI on WordPress.org upload)

= 1.2.0 =
* Rename plugin to Takahiro Revision Cleanup (takahiro-revision-cleanup) per WordPress.org review
* Update Author and Plugin URI to https://takahiro-nishii.com
* Remove load_plugin_textdomain() (WordPress.org hosts translations)
* Expand function prefix from crm_ to tnrc_ (4+ characters)

= 1.1.2 =
* Add centralized TNRC_Security layer (form tokens, action allowlist, rate limits)
* Strict allowlist for CHECK/OPTIMIZE TABLE (wp_posts and wp_postmeta only)
* Cap bulk deletes at 2000 revisions per request with user warning
* Validate transient notice and db_check payloads before display
* Add tnrc_security_event audit hook for monitoring integrations
* Block direct directory access via index.php stubs

= 1.1.0 =
* Add paginated revision list preview (Better Delete Revision parity)
* Add lifetime deleted revisions counter
* Add CHECK TABLE before OPTIMIZE TABLE
* Use wp_delete_post_revision() for safer meta/term cleanup
* Add NextGEN Gallery batch-delete compatibility
* Add Settings link on the Plugins screen

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.3.0 =
Adds one-click progressive deletion with a progress bar for large revision sets.

= 1.2.1 =
Fix WordPress.org upload validation (Plugin URI removed).

= 1.2.0 =
Renamed for WordPress.org review. Deactivate the old slug and activate takahiro-revision-cleanup.

= 1.1.2 =
Security hardening: form tokens, rate limits, stricter validation, and audit hooks.

= 1.1.0 =
Adds revision preview list, database check, and Better Delete Revision compatibility improvements.

= 1.0.0 =
Initial release.
