=== flux360 Precision Delete ===
Contributors: flux360, serkanceyhan
Tags: bulk delete, woocommerce, seo, redirect, cleanup
Requires at least: 5.8
Tested up to: 6.9
Stable tag: 3.0.2
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

SEO-safe bulk delete tool for WordPress. Safely remove thousands of products, posts, and media with auto 301 redirects and multilingual sync.

== Description ==

**flux360 Precision Delete** is a professional cleanup solution designed for high-volume WooCommerce stores and content-heavy websites. It allows you to search, filter, and bulk delete thousands of items (Products, Posts, Pages, Media) safely, without overwhelming your server or breaking your SEO.

Most plugins just delete; we protect your rankings while cleaning up.

### Key Features

* **Smart Bulk Delete (AJAX):** High-performance deletion process that runs in batches to prevent server timeouts (504 errors), even with 10,000+ items.
* **Auto 301 Redirects:** Automatically redirect deleted URLs to your homepage or a custom URL. Prevent 404 errors and preserve your SEO ranking.
* **Multilingual Sync (WPML & Polylang):** Deleting a product? The plugin automatically detects and offers to remove its translations, keeping your database clean across all languages.
* **Precision Filters:** Filter content by Title, Date Range, Post Type, SKU, or Status (Draft, Private, Trash).
* **WooCommerce Optimized:** Full support for WooCommerce Products, allowing you to clean up old stock or discontinued items in seconds.
* **Media Cleanup:** Automatically remove featured images and attachments associated with deleted posts to save disk space.
* **History & Logs:** Keep a clear record of every deleted item and its redirection path.

### Why flux360 Precision Delete?

Unlike standard cleanup tools, we focus on **Safety** and **SEO Integrity**.
1.  **Safety First:** A clear two-step confirmation (Search -> Review -> Delete) ensures no accidental data loss.
2.  **SEO Continuity:** We handle the "aftermath" of deletion by managing redirects instantly.
3.  **No Server Stress:** Optimized for shared hosting and large databases using smart AJAX batching.

== Installation ==

1. Upload the `flux360-precision-delete` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. A new menu item **"Precision Delete"** will appear in your main admin sidebar (with a trash icon). Click on it to access the dashboard.

== Usage ==

**Step 1: Search for Items**
Use the dashboard to find the content you want to delete.

1.  **Match Logic:** Choose how strictly you want to match your keywords:
    *   *Exact Match:* Only matches items with the exact title.
    *   *Contains (Partial):* Matches items containing the keyword.
    *   *Starts With:* Matches items beginning with the keyword.
2.  **Search In:**
    *   *Auto:* Searches all supported content types.
    *   *SKU / Name:* Restrict search to specific fields (useful for products).
3.  **Language (Optional):** If you use WPML or Polylang, select a specific language to filter results.
4.  **Include Media:** Check this if you also want to search for Media Library items.
5.  **Enter Keywords:** Type your search terms in the text area (one keyword per line). **Do not use commas** to separate terms.
6.  Click **"Start Smart Search"**.

**Step 2: Review Results & Translations**
The plugin displays found items with intelligent options.

1.  **Review Items:** check the list of found items.
2.  **Automatic Redirects:** The plugin automatically suggests a redirect target (usually the item's **Parent Category**). This ensures users landing on the deleted URL are guided to a relevant page instead of a 404 error.
    *   *Toggle Redirect:* Uncheck the box in the "301" column if you strictly want a 404 for a specific item.
3.  **Multilingual Sync:** If an item has translations, they will appear nested below the main item.
    *   They are selected by default. Uncheck any translation you wish to keep while deleting the main item.
4.  Click **"Add to Cart"** (or "Add All to Cart") to stage them for deletion.

**Step 3: Process Deletion**
Finalize the cleanup.

1.  Review your **"Cart"** on the right side of the screen.
2.  Click **"MOVE TO TRASH & REDIRECT"**.
3.  Confirm the action. The items will be deleted (moved to trash or permanently deleted based on WordPress settings) and the 301 redirects will be created instantly.

**Step 4: History**
*   The "History" table at the bottom shows recently deleted items and their active redirect targets.


== Frequently Asked Questions ==

= Is it safe for large databases? =
Yes. Our AJAX batching technology ensures that even with 50,000+ products, your server remains stable.

= Does it support Custom Post Types? =
Absolutely. It works with all public CPTs, including Portfolios, Testimonials, and more.

= Can I restore deleted items? =
If you choose "Move to Trash," you can restore them via the standard WordPress Trash. If you choose "Permanent Delete," it's gone—but your 301 redirects will keep your SEO safe.

== Screenshots ==

1. Configure dynamic access control so Shop Managers can use the plugin.
2. The detailed History Log showing redirected URLs and deletion stats.
3. The intuitive dashboard with advanced filtering options and inline redirect management.
4. Floating Precision Delete Cart widget seamlessly integrated into WordPress post and product lists.
5. The centralized Trash Manager dashboard for bulk restore and force delete operations.

== Changelog ==

= 3.0.2 =
* Hotfix: Pushed missing files `CartUI.php`, `Settings.php`, and `TrashPage.php` to the WordPress repository that were previously missing from the SVN commit.

= 3.0.1 =
* Hotfix: Resolved a fatal error caused by explicitly missing manual class inclusions for environments with strict autoloader restrictions.

= 3.0.0 =
* Major Feature: Added floating Precision Delete Cart widget to standard WP post and product lists.
* Major Feature: Added centralized Trash Manager dashboard for bulk restore and force delete.
* Enhancement: Redesigned the UX to prevent backend dashboard redirects when deleting items. 
* Enhancement: WooCommerce product category resolution now actively defaults to the primary `product_cat` instead of simple `category`.
* Enhancement: Added "Permanent Delete (Skip Trash)" options across the board.
* Enhancement: Added "Delete All" fast-action to search results.
* Security: Elevated codebase to stricter PHPCS standards, replacing standard redirects with safe redirects and adding caching wrappers to direct DB queries.

= 2.1.2 =
* Official stable release for WordPress.org.
* Improved AJAX processing for high-load servers.

= 2.1.0 =
* Rebrand: Renamed to "flux360 Precision Delete".
* Feature: Enhanced Auto-Redirect logic.
* Feature: Improved WPML/Polylang synchronization.

= 2.0.5 =
* Fix: Resolved PHPCS warnings and improved security headers.