=== Auto Slug Redirect ===
Contributors: snehalpancholi
Tags: redirect, slug, permalink, 301, seo
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

Automatically creates 301 redirects when post slugs change. Never lose SEO value when reorganizing your content.

== Description ==

When a published post or page slug changes, Auto Slug Redirect automatically captures the old URL and creates a permanent 301 redirect to the new permalink. No configuration needed — it works silently in the background.

**Features:**

* Automatic slug-change detection on posts and pages
* Permanent 301 redirect serving with zero performance overhead
* Hit counter per redirect so you can see which old URLs are still in use
* Manual redirect management from Settings > Slug Redirects
* Delete individual redirects from the admin dashboard
* Add redirects manually for any URL path
* Administrators are never redirected — they can always access old URLs without being bounced
* Lightweight: one small DB table, one targeted DB query per uncached page load
* No jQuery dependency — pure WordPress APIs

== Installation ==

1. Upload the `auto-slug-redirect` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. The plugin is immediately active — no configuration required.
4. Navigate to **Settings > Slug Redirects** to view, delete, or manually add redirects.

== Frequently Asked Questions ==

= Does the plugin redirect administrators? =

No. Logged-in users with `manage_options` capability are never redirected. This lets administrators freely access old URLs without being bounced.

= What happens if I change a slug back to its original value? =

A new redirect record is created pointing from the intermediate slug to the original. Old redirects to previous slugs remain in place. You can clean up stale records manually from the admin page.

= Will this slow down my site? =

No. The redirect check runs only on `template_redirect`, after WordPress has already determined the current URL does not match any existing post. One indexed DB query is executed per page load only when WordPress would otherwise show a 404.

= Can I add redirects for non-WordPress URLs? =

Yes. Use the manual add form on the Settings > Slug Redirects page. Enter any URL path (e.g. `/old-category/old-post/`) and any full destination URL.

= What is stored in the database? =

All redirects are stored in the `{prefix}asr_redirects` custom table. The table is created on plugin activation and removed on uninstall.

= Does it support custom post types? =

Currently the automatic detection is limited to `post` and `page` post types. You can always add redirects for custom post type URLs manually.

== Screenshots ==

1. Settings > Slug Redirects — table of all stored redirects with hit counters and delete actions.
2. Manual add form below the redirects table.

== Changelog ==

= 1.0.0 =
* Initial release.
* Automatic slug-change detection for posts and pages.
* 301 redirect serving via `template_redirect`.
* Hit counter per redirect.
* Admin page with table, pagination, delete, and manual add form.
* AddonLogic update system integration.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
