=== RankLite – Fast, Clean SEO ===
Contributors: ranklite
Tags: seo, sitemap, schema, open graph, meta tags
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fast, clean SEO: titles & meta, Open Graph/Twitter Cards, JSON-LD schema, and XML sitemaps with Google/Bing pings. No bloat, no tracking.

== Description ==

**RankLite** focuses on the essentials of on-page SEO. It’s intentionally small, fast, and easy to configure. You get all the core tools—without the kitchen sink:

- **Titles & Meta Descriptions** per post/page with live counters
- Global defaults with smart fallbacks
- **Open Graph** & **Twitter Cards** (title, description, image)
- **Canonical** and **robots** meta (index/noindex, follow/nofollow)
- **XML Sitemaps** (`/sitemap.xml`) with pretty permalink support and **pings to Google & Bing**
- **JSON-LD Schema** for Website, Article, Breadcrumbs + FAQ/How-to blocks (basic)
- **Breadcrumbs** output helper
- **Manual 301 Redirects**
- **Analytics helpers** (Google Analytics/GTAG & Google Tag Manager passthrough)
- Optional **data wipe** on uninstall
- Multisite-aware and performance-minded

No telemetry. No ad pixels. No phone-home calls—everything stays on your site.

### Why RankLite?

- **Performance first.** Lightweight code, minimal queries, no admin nag spam.
- **No lock-in.** Uses standard WordPress fields/meta so you can switch any time.
- **Clean UI.** Sensible defaults and clear controls that won’t overwhelm you.

### What’s included in the Free version?

- Titles/meta with counters and fallbacks
- Canonical, robots
- Open Graph & Twitter Cards
- Website/Article/Breadcrumbs + FAQ/How-to schema (basic, JSON-LD)
- XML sitemaps with **Google/Bing pings**
- Breadcrumbs helper
- Manual redirects (301)
- Analytics & GTM helpers
- Tools page with **wipe on uninstall** option

### Pro add-on

A separate Pro add-on (not required) can extend RankLite with AI-assisted titles/descriptions/alt-text/articles, advanced schema & sitemaps, a 404 monitor, and auto-redirects. The free plugin is fully functional on its own and does not require Pro.

== Features ==

- **Meta box on posts/pages** for custom SEO Title & Description
- **Smart fallback** to site title/tagline or post excerpt
- **Open Graph/Twitter image** fallback
- **Robots** (index/noindex, follow/nofollow) per post and global
- **Sitemaps**: index + post types; pretty `/sitemap.xml` with:
  - Fallback query route for non-pretty permalinks
  - **Automatic pings to Google and Bing** when content changes (with safe throttling)
- **Schema**: Website, Article, Breadcrumbs + FAQ/How-to via blocks (basic) with safe defaults
- **Breadcrumbs**: simple template function/filter to output a trail
- **Redirects**: add simple 301 manual redirects from an admin screen
- **Analytics**: GA4/gtag and GTM helpers (paste ID and go)
- **Developer-friendly** (filters/actions documented below)
- **Privacy-friendly**: no data leaves your site

== Screenshots ==

1. Titles & Meta: per-post editor with live counters
2. Global settings: Titles, Social, Indexing
3. XML Sitemaps settings with Google/Bing pings
4. Schema (Website, Article, FAQ, How-to) basic controls
5. Analytics helpers (GA4/GTAG & GTM passthrough settings)
6. Redirects screen (manual 301s)
7. Tools, uninstall & reset options

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/ranklite/` or install it from **Plugins → Add New**.
2. Activate **RankLite**.
3. Go to **Settings → RankLite** to configure Titles, Social, Indexing, Sitemaps, Schema, and Tools.
4. Optional: Add your GA4/GTAG or GTM container ID in **Analytics**.

== Frequently Asked Questions ==

= Does the plugin collect any personal data? =

No. RankLite does not send data to external servers and does not implement telemetry. See the Privacy section.

= Will it work with caching plugins? =

Yes. RankLite only outputs meta/schema/headers and a dynamic sitemap. Everything plays well with full-page caching.

= Can I noindex specific content? =

Yes. Use the global defaults in **Settings → RankLite → Indexing**, and override per post/page inside the meta box.

= Does it write to robots.txt on disk? =

No. RankLite uses the `robots_txt` filter to serve a virtual robots.txt.

= How do I remove all plugin data on uninstall? =

In **Settings → RankLite → Tools**, enable **“Wipe all data on uninstall”**. When checked, RankLite deletes its options and (optionally) RankLite post/term meta upon uninstall.

= Does RankLite ping Google and Bing when sitemaps change? =

Yes. When sitemaps are enabled, RankLite will ping Google and Bing when content changes, using short timeouts and safe throttling so it doesn’t slow down your site.

= Is WooCommerce supported? =

Yes—RankLite works alongside WooCommerce. You can set global defaults and then override titles/meta on individual products as needed.

= Is there a Pro version? =

Yes, offered separately. The free plugin is fully usable by itself. The Pro add-on adds AI-assisted writing features, advanced schema/sitemaps, a 404 monitor, and auto-redirects.

== Privacy ==

This plugin **does not**:

- Collect personal data
- Send usage data to third parties
- Set cookies on the front end by itself

If you enable Analytics or GTM helpers, you are integrating external services—ensure you have the proper disclosures/consent (e.g., via your cookie banner).

== Performance ==

- Minimal queries and safe caching behavior
- No assets loaded on the front end unless necessary
- Short timeouts and safe throttling for sitemap pings to Google/Bing

== External services ==

This plugin can optionally connect to the following external services:

1. Google Search and Bing (sitemap ping)
- What it does: When sitemap pinging is enabled, RankLite can notify search engines that your sitemap has been updated.
- What is sent: The public URL of your sitemap is sent as a query parameter to:
  - https://www.google.com/ping?sitemap=
  - https://www.bing.com/ping?sitemap=
- When: Only when sitemap pinging is enabled in the plugin settings and a sitemap is generated/updated.
- Terms / Privacy:
  - Google: https://policies.google.com/privacy / https://policies.google.com/terms
  - Microsoft (Bing): https://privacy.microsoft.com / https://www.microsoft.com/servicesagreement

2. Google Analytics / Google Tag Manager (optional)
- What it does: If you choose to enable Analytics or Tag Manager in RankLite, the plugin outputs the official tracking/snippet code provided by Google.
- What is sent: Standard analytics/usage data as defined by Google, associated with your own property IDs (e.g. GA4, GTM). No additional data is sent by RankLite beyond what Google’s scripts normally collect.
- When: Only when you explicitly enable these features and enter your own tracking IDs.
- Terms / Privacy:
  - Google Analytics / Tag Manager: https://marketingplatform.google.com/about/analytics/terms/us/
  - Google Privacy Policy: https://policies.google.com/privacy

== Developers ==

### Filter the final title string

```php
/**
 * Filter the final <title> value RankLite outputs.
 *
 * @param string       $title Final title string.
 * @param array        $parts Parsed parts (h1, site_name, brand, etc).
 * @param WP_Post|null $post  Current post object (or null).
 * @param string       $type  Detected type: 'news' | 'product' | 'default'.
 */
add_filter( 'ranklite_meta_title_final', function( $title, $parts, $post, $type ) {
    return $title;
}, 10, 4 );
```

### Add extra sitemap index entries (e.g. news/video)

```php
add_filter( 'ranklite/sitemaps/index_items', function( $extra, $opts ) {
    $extra[] = array(
        'loc'     => home_url( '/news-sitemap.xml' ),
        'lastmod' => gmdate( 'c' ),
    );
    return $extra;
}, 10, 2 );
```

### Tweak the breadcrumb trail before output

```php
add_filter( 'ranklite_breadcrumb_trail', function( $trail ) {
    // $trail is an array of arrays like [ 'name' => 'Blog', 'url' => 'https://example.com/blog/' ].
    return $trail;
} );
```

### Programmatic redirect registration

```php
do_action( 'ranklite/register_redirect', '/old-path', '/new-path', 301 );
```

See inline docs for more hooks and parameters.

== Changelog ==

= 1.0.4 =
* Fix: Sitemap rewrites/router initialization issue on some installs.
* Add: Optional category and tags sitemap support.
* Fix: Cookie consent banner now closes correctly on accept/reject/manage.

= 1.0.3 =
Compatibility and security hardening: improved URL/path handling, safer redirect sanitization, removed cross-hook output buffering, and form handling now reads only required fields.

= 1.0.2 =
* Security hardening: sanitize/validate inputs in admin handlers and term/meta saves.
* Fix: close output buffers properly for schema exclusivity.
* Fix: harden settings import validation.

= 1.0.1 =
* Code cleanup and compatibility improvements based on WordPress.org review.

= 1.0.0 =
* Initial public release.
* Titles & meta with counters and fallbacks.
* XML sitemaps with pretty `/sitemap.xml`, fallback routes, and Google/Bing pings.
* Website/Article/Breadcrumbs + FAQ/How-to schema (basic, JSON-LD).
* Open Graph/Twitter Cards, breadcrumbs helper, manual redirects, analytics/GTM helpers.
* Tools screen with wipe-on-uninstall option and uninstall cleanup logic.

== Upgrade Notice ==

= 1.0.1 =
Code cleanup and compatibility improvements based on WordPress.org review.

= 1.0.2 =
* Security hardening: sanitize/validate inputs in admin handlers and term/meta saves.
* Fix: close output buffers properly for schema exclusivity.
* Fix: harden settings import validation.

= 1.0.3 =
Compatibility and security hardening: improved URL/path handling, safer redirect sanitization, removed cross-hook output buffering, and form handling now reads only required fields.

= 1.0.4 =
* Fix: Sitemap rewrites/router initialization issue on some installs.
* Add: Optional category and tags sitemap support.
* Fix: Cookie consent banner now closes correctly on accept/reject/manage.