=== Instant 404 Smart Fixer ===
Contributors: hussambarbour
Tags: 404, redirect, seo, smart match, auto redirect
Requires at least: 5.0
Tested up to: 6.9
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Smartly monitors 404 errors and auto-redirects to matching content using a high-performance algorithm.

== Description ==

Instant 404 Smart Fixer is a lightweight, high-performance plugin designed to recover lost traffic from broken links. instead of showing a generic 404 error page, it intelligently searches your existing content for a match and redirects the user automatically.

**Key Features:**

*   **Smart Match Algorithm:** Extracts keywords from the 404 URL and searches for matching Posts, Pages, or Custom Post Types with >80% similarity.
*   **High Performance:** Uses optimized `WP_Query` calls and WordPress Transients API to cache redirect decisions for 24 hours, ensuring zero impact on server load for repeated hits.
*   **Zero Bloat:** Built with a focus on speed and simplicity. No heavy frameworks or unnecessary database tables.
*   **Admin Logging:** View the last 10 redirect events in the settings page to see exactly what the plugin is doing.
*   **Privacy Focused:** Does not track user data, only logs the URL string for debugging purposes.

**How it works:**

1.  A user visits a broken URL (e.g., `/my-amsome-post`).
2.  The plugin detects the 404.
3.  It searches for a post with a similar title (e.g., "My Awesome Post").
4.  If a match is found, it performs a **301 Permanent Redirect** to the correct post.
5.  If no match is found, it redirects to the Homepage (302) to keep the user on the site.

== Installation ==

1.  Upload the `instant-404-smart-fixer` folder to the `/wp-content/plugins/` directory.
2.  Activate the plugin through the 'Plugins' menu in WordPress.
3.  Go to **Settings > Instant 404** to enable the smart matching feature.

== Frequently Asked Questions ==

= Does this modify my database? =

No. It uses standard WordPress options for settings and the Transients API for caching. It does not create custom tables.

= Can I clear the cache? =

The cache automatically expires every 24 hours. If you need to clear it manually, you can use a transient manager plugin or simply wait.

= What happens if two posts have similar titles? =

The algorithm picks the match with the highest similarity percentage found within the top search results.

== Screenshots ==

1.  **Settings Page** - Simple configuration with a log of recent redirects.

== Changelog ==

= 1.0.0 =
*   Initial release.
*   Implemented Template Redirect monitoring.
*   Added Smart Match logic with `similar_text`.
*   Added Admin Settings and Logging.
