=== Amplest Autopilot — AEO & AI Search Optimization for WordPress ===
Contributors: amplest, 2ndbrospec
Tags: seo, schema, ai, structured-data, aeo
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.4.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI reads your content, then recommends your competitor. Amplest adds AEO on top of your SEO — without breaking Yoast or Rank Math — so AI cites you.

== Description ==

**AI is reading your content. But is it recommending your site?**

Every day, ChatGPT, Gemini, Perplexity, Copilot, and Claude scrape WordPress sites to answer user questions. They use your content to build their answers — but without AEO (Answer Engine Optimization), they cite your competitor instead of you.

Strong Google SEO doesn't fix this. A #1 ranking means nothing to AI citation. A competitor with weaker SEO can beat you in AI search if their structured data, FAQ schema, and authority signals are better configured than yours. Your content feeds the AI. Someone else gets the customer.

**Amplest Autopilot adds the AEO layer that makes AI cite you — without touching your Yoast SEO, Rank Math, or All in One SEO configuration.**

It works alongside your existing SEO setup. Never overwrites. Never conflicts. The plugin detects which SEO plugin you're running and integrates through its official hooks — so you keep one clean `<meta name="description">` and no duplicate structured data.

This plugin is the on-site engine of [Amplest](https://amplest.cloud) — an AI search optimization platform. Install it and your WordPress site connects to Amplest's cloud intelligence: continuous LLM citation monitoring, AI-powered diagnosis, and automated fixes pushed directly to your site. The plugin handles the on-site layer; Amplest handles the strategy.

= What works on your site from day one (free, no account needed) =

Activate the plugin and your site immediately gets the AEO foundation that makes AI citation possible — no license key, no account, no configuration required.

* **Structured Data (JSON-LD)** — Automatically generates and injects Organization, WebSite, Article, FAQPage, and BreadcrumbList schemas into `<head>`. Works alongside Yoast, Rank Math, and All in One SEO without duplicate tags.
* **Auto FAQ Detection** — Scans post content for question-pattern headings (English and Japanese) and converts them into FAQPage schema automatically. No manual markup needed.
* **AEO Metabox** — Add an AI summary, target keywords, and custom Q&A in the post editor to guide how AI reads and cites your content.
* **llms.txt** — Dynamically serves `/llms.txt` per the llmstxt.org standard — an always-current map of your key content for AI crawlers.
* **AI Score Widget** — See your AI visibility score directly in the WordPress dashboard.

= What the Amplest Cloud Service adds (optional SaaS integration) =

Connect a paid plan at [amplest.cloud](https://amplest.cloud) to unlock the cloud platform layer:

* **LLM Citation Monitoring** — Your site is tested across ChatGPT, Gemini, Perplexity, Copilot, and Claude to track whether and how they cite you.
* **AI-Powered Diagnosis** — Amplest scans your site, identifies what's limiting your AI visibility, and generates a prioritized improvement list.
* **Automated Fix Application** — Approved improvements are pushed to your site through the plugin's REST API — structured data, meta tags, and AEO fields updated without touching your theme or post content.
* **Snapshot & Rollback** — Every applied fix is snapshotted before it runs. Roll back any change at any time from the Amplest dashboard.
* **Monthly / Weekly Reports** — Track your AI visibility score over time with detailed diagnosis and improvement history.

= Plans =

**Free** — No account needed. Structured data injection, AEO metabox, llms.txt, and AI Score widget activate immediately after installing the plugin.

**Planner ($35/mo)** — Monthly LLM scan, improvement suggestions, and email reports. Connects your site to the Amplest diagnosis engine.

**Operator ($110/mo)** — Weekly automatic LLM citation scan, full issue list, on-demand manual scan requests, and human-approved automatic fix application. For site owners who want control with less manual work.

**Autopilot ($220/mo)** — Fully automated optimization with no approval required. Built for agencies and businesses running multiple sites.

[See full plan details →](https://amplest.cloud/pricing)

== Installation ==

1. In your WordPress admin, go to **Plugins > Add New**
2. Search for **Amplest Autopilot**
3. Click **Install Now**, then **Activate**
4. Go to **Settings > Amplest Autopilot** to configure the plugin
5. Enter your license key and click **Activate License**

= Manual Installation =

1. Upload the plugin folder to `/wp-content/plugins/amplest-autopilot/`
2. Activate the plugin from the **Plugins** screen in WordPress
3. Go to **Settings > Amplest Autopilot** to configure

== Frequently Asked Questions ==

= My SEO is strong. Why isn't ChatGPT recommending my site? =

Because SEO and AEO are different games. Google ranks pages by authority, backlinks, and relevance. AI tools like ChatGPT, Gemini, and Perplexity cite pages based on structured data completeness, FAQ schema, answer-ready content structure, and authorship signals — none of which SEO rankings measure. A competitor with weaker SEO but proper AEO setup can outrank you in AI search. Amplest Autopilot adds that AEO layer automatically.

= Does this replace Yoast SEO or Rank Math? =

No — it runs alongside them. Amplest Autopilot handles AEO (AI citation optimization), which is a separate layer from what Yoast and Rank Math do. Yoast and Rank Math optimize for Google search. Amplest optimizes for AI citation. You need both. As of v1.4.0, Amplest integrates through Yoast's and Rank Math's official filter hooks, so there are no duplicate meta tags and no conflicts.

= I already use a structured data plugin. Will this conflict? =

Amplest Autopilot detects existing structured data output from Yoast SEO, Rank Math, All in One SEO, and The SEO Framework. Where those plugins already emit breadcrumb schema, Amplest skips its own BreadcrumbList output to prevent duplicates. Meta description and title are written through each plugin's official hooks — one clean tag, no conflicts.

= Can I use this alongside Yoast SEO, Rank Math, or All in One SEO? =

Yes — and as of version 1.4.0, Amplest Autopilot explicitly integrates with them. When Yoast SEO, Rank Math, All in One SEO, or The SEO Framework is active, Amplest applies its meta description and title through that plugin's official filter hooks (`wpseo_metadesc`, `rank_math/frontend/description`, `aioseo_description`, `the_seo_framework_description`), so you keep a single `<meta name="description">` tag with the Amplest-optimized value — no duplicate tags, no conflicts. BreadcrumbList JSON-LD is also automatically skipped when one of these plugins is already emitting breadcrumb schema, to avoid duplicate structured data warnings in Search Console.

= Where do I get a license key? =

Create an account at [amplest.cloud](https://amplest.cloud), choose a plan, and your license key will be issued immediately.

= What can I use on the Free plan? =

The Free plan automatically injects all structured data types (Organization, WebSite, Article, FAQPage, BreadcrumbList), enables the AEO metabox in the post editor, generates `/llms.txt` for AI crawlers, and shows the AI Score widget in your dashboard — no license key required. All on-site features are fully functional without an account.

= How does Auto FAQ Detection work? =

Amplest Autopilot scans your post content for H2/H3 headings that look like questions — headings ending with `?`, or starting with words like "What", "How", "Why", "Can", etc. (English) or containing patterns like「とは」「方法」（Japanese). Matching heading + paragraph pairs are automatically converted into FAQPage structured data.

= What is the AI Score? =

The AI Score reflects how well your site is positioned to be cited by the 5 major LLMs. Amplest scans your site across ChatGPT, Gemini, Perplexity, Copilot, and Claude and returns a score from 0–100. Higher scores mean better AI visibility.

= What is llms.txt? =

`llms.txt` is an emerging standard (llmstxt.org) that helps AI crawlers quickly understand a website's structure and key content — similar to `robots.txt` but designed for large language models. Amplest Autopilot generates this file dynamically, so it always reflects your latest pages and articles.

= Can I roll back an automatic fix? =

Yes. Before every automatic fix is applied, the plugin creates a snapshot of the existing data and saves a WordPress post revision. You can roll back any applied fix at any time from the Amplest dashboard.

== Screenshots ==

1. Settings — Connect your site to Amplest cloud. Structured data starts injecting immediately after activation, no license key required.
2. Feature controls — Toggle structured data types, Auto FAQ Detection, and AEO Metabox. Works alongside Yoast, Rank Math, and All in One SEO with zero conflicts.
3. AEO Metabox in the post editor — Set an AI summary, target keywords, and custom Q&A per post. Auto-converts to FAQPage JSON-LD so AI tools can read and cite your content.
4. Dashboard widget — Your AI Visibility Score, the 5 most recently applied improvements, and a one-click scan request button. See exactly what changed and when.

== External Services ==

This plugin functions as a fully standalone tool for local schema generation, llms.txt, and the AEO metabox — no external service is required for these features.

Optionally, the plugin integrates with the **Amplest cloud platform** to provide AI-powered diagnostics, improvement suggestions, and automated fix delivery. When this integration is active, the plugin communicates with Amplest as described below.

* Service: Amplest (https://amplest.cloud)
* Terms of Service: https://amplest.cloud/legal/terms
* Privacy Policy: https://amplest.cloud/legal/privacy

= Plugin → Amplest (outbound calls) =

* **License activation / deactivation** — When you click "Activate License" or "Deactivate License", your license key and site domain are sent to `https://amplest.cloud/api/wp-plugin/activate` or `.../deactivate`. Data sent: license key, site domain.
* **Daily license verification** — Once per day via WP-Cron, the plugin sends your license key and site domain to `https://amplest.cloud/api/wp-plugin/verify` to confirm subscription status. Data sent: license key, site domain.
* **AI Score retrieval** — When you click "Refresh Score", your site domain is sent to `https://amplest.cloud/api/wp-plugin/score` to fetch your current AI visibility score. Data sent: license key, site domain.
* **Scan request** — When you click "Request Scan" (Operator / Autopilot plans only), your site domain is sent to `https://amplest.cloud/api/wp-plugin/scan` to trigger an LLM citation scan. Data sent: license key, site domain.

= Amplest → Plugin (inbound webhook) =

* **Automated fix delivery** — When you approve an improvement in the Amplest dashboard, the Amplest service calls this plugin's REST endpoint (`/wp-json/amplest/v1/apply-fix`) and passes the generated content (structured data, meta tags, FAQ items, image alt overrides, or breadcrumb settings). The plugin writes that content to WordPress post meta locally. **No data from your site is transmitted outbound via this endpoint.**
* **Article drafts (1.4.0+)** — When you approve a generated article in the Amplest dashboard, the Amplest service may call `/wp-json/amplest/v1/posts/draft` and pass the title, body HTML, meta description, tags, and FAQ. The plugin creates a new post with `post_status='draft'` — **the post is never published automatically; you review and publish it from your WordPress admin.** Meta description is synced to Yoast / Rank Math / All in One SEO meta keys when one of these plugins is detected.
* **Rollback** — Similarly, the Amplest service may call `/wp-json/amplest/v1/rollback` to restore a previously saved snapshot. All operations are local (post meta read/write only).

These inbound endpoints use **WordPress Application Passwords** (a WordPress core feature, WP 5.6+) for authentication. No custom auth protocol is required.

No personal user data is collected or transmitted. Only your site domain and license key are used for outbound calls.

== Changelog ==

= 1.4.4 =
* Fixed: `apply-fix` no longer checks `current_user_can('edit_post')` when authenticated via license key — removed redundant WP capability check that blocked all license-key-authenticated requests with 403.

= 1.4.3 =
* Fixed: REST API endpoints now correctly read the license key from `amplest_license_data` option (was referencing a non-existent `amplest_license_key` option, causing all authenticated requests to fail with 403).

= 1.4.2 =
* Security: REST API endpoints (`apply-fix`, `rollback`, `posts/draft`) now authenticate via the `X-Amplest-License-Key` header instead of WordPress Application Passwords. No setup required — the license key entered during activation is reused automatically.

= 1.4.1 =
* Changed: Updated plugin icon to new brand logo (wing mark) — icon.svg, icon-128x128.png, and icon-256x256.png refreshed to match current brand identity.
* Changed: Admin settings page now displays the Amplest logo icon in the page header alongside the page title.
* Changed: Admin UI brand color updated from purple to emerald green to align with current brand identity.

= 1.4.0 =
* Fixed: improve_meta now actually replaces meta description and document title. Previous versions emitted a non-standard `<meta name="amplest:description">` tag that had no SEO effect. The plugin now detects Yoast SEO, Rank Math, All in One SEO, or The SEO Framework and overrides the description/title via that plugin's filter hook (avoiding duplicate tags). When no SEO plugin is active, a standard `<meta name="description">` is emitted and the document title is filtered via `pre_get_document_title`.
* Added: improve_alt action_type — image alt attributes can now be auto-applied via post meta override (no post_content modification, fully reversible by deleting the meta entry). Renders at output time via `wp_get_attachment_image_attributes` and a regex pass over `the_content`.
* Added: add_breadcrumb action_type — per-post breadcrumb flag plus a new `[amplest_breadcrumb]` shortcode for HTML breadcrumb display. HTML breadcrumb is opt-in (shortcode placement), respecting WordPress.org guidelines on not surprising users. BreadcrumbList JSON-LD output now skips when Yoast / Rank Math / AIOSEO already emits it (duplicate-detection).
* Added: `POST /wp-json/amplest/v1/posts/draft` endpoint — receives AI-generated articles from the Amplest cloud and saves them as drafts for user review. Meta description is synced to Yoast / Rank Math / AIOSEO meta keys when detected. Idempotent by topic_id (reuses existing draft on retry).
* Added: optimize_meta_for_ctr action_type — alias for improve_meta.
* Added: `/wp-json/amplest/v1/ping` now returns `supported_actions[]`, `endpoints{}`, and `detected_seo_plugin` so the Amplest cloud can adapt requests to the installed plugin version.
* Added: Dashboard widget now shows the 5 most recently applied improvements across the site (post title, change type, timestamp) with direct edit links.
* Changed: `/apply-fix` and `/posts/draft` now return HTTP 402 with an upgrade URL for sites on the Free plan. The Free plan provides local features (structured data, AEO metabox, llms.txt, AI Score widget) without restriction; auto-apply and article generation require a paid Amplest plan.
* Removed: legacy `<meta name="amplest:description">` / `<meta name="amplest:title">` output — these had no SEO effect and only added noise to `<head>`.

= 1.3.1 =
* Security: Improved REST API endpoint permissions — /apply-fix and /rollback now require edit_others_posts capability (Editor or Administrator) instead of edit_posts, and additionally verify the authenticated user can edit the specific target post (current_user_can('edit_post', $post_id)).
* Fixed: Refresh Score no longer sends an HTTP request to Amplest when no license key is configured — returns an informational error message instead.
* Fixed: Dashboard widget footer link now uses a direct UTF-8 arrow character instead of an HTML entity inside esc_html_e(), correcting display on English-locale sites.
* Fixed: Custom JSON-LD injected via the apply-fix REST endpoint is now output via wp_json_encode(json_decode()) instead of wp_kses(), ensuring valid and safe JSON output in all cases.

= 1.3.0 =
* Fixed: /apply-fix and /rollback REST endpoints now use WordPress Application Passwords for authentication instead of requiring an active paid license.
* Fixed: Settings page upgrade CTA now references cloud-only features (LLM monitoring, AI diagnosis, automated fix delivery) — no longer implies that local features require a paid plan.
* Fixed: Removed "Planner plan or higher required" notices from the Auto FAQ Detection and AEO Metabox settings. Both features are fully functional on all plans including Free.
* Added: "Amplest Cloud Connection" section in settings explaining how to set up WordPress Application Passwords for the Amplest service.
* Updated: External Services section in readme now separately documents outbound (plugin → Amplest) and inbound (Amplest → plugin webhook) communication, with specific API endpoint URLs and data sent.

= 1.2.0 =
* Changed: JSON-LD structured data (Article, FAQPage, BreadcrumbList, AEO summary) now available for all plans including Free
* Changed: AEO metabox (AI summary, keywords, FAQ) now fully accessible for all plans including Free
* Fixed: Removed `JSON_UNESCAPED_SLASHES` from JSON-LD output to prevent potential XSS via `</script>` in content strings
* Removed: `load_plugin_textdomain()` call — WordPress auto-loads translations for plugins hosted on WordPress.org

= 1.1.0 =
* Added: llms.txt auto-generation — dynamically serves `/llms.txt` for AI crawlers (top 30 pages + 30 articles, with total count shown for larger sites)
* Added: Snapshot and rollback system — every automatic fix creates a WordPress revision and a meta snapshot; roll back any change from the Amplest dashboard
* Added: Custom JSON-LD and meta tags injected via the Amplest REST API are now correctly output in `<head>`
* Fixed: License authentication in the REST API (`apply-fix` endpoint was always returning 401 due to incorrect option key and field name)
* Fixed: `plan_tier` values from the Amplest API are now validated against a whitelist to prevent unexpected tier escalation
* Fixed: All hardcoded Japanese strings in `admin.js` replaced with localized `amplestAdmin.*` values
* Internationalization: all UI strings converted to English; Japanese .po/.mo files included
* Updated plan names to Free / Planner / Operator / Autopilot (aligned with amplest.cloud pricing)

= 1.0.0 =
* Initial release
* Auto JSON-LD injection (Organization, WebSite, Article, FAQPage, BreadcrumbList)
* Auto FAQ detection
* AEO metabox (AI summary, keywords, FAQ)
* AI Score dashboard widget
* License management system

== Upgrade Notice ==

= 1.4.0 =
Strongly recommended. Previous versions emitted an Amplest-prefixed `<meta name="amplest:description">` tag that had no SEO effect, so applied meta-description improvements were not actually visible to search engines or AI crawlers. 1.4.0 fixes this by writing to the standard `<meta name="description">` tag — and integrates directly with Yoast SEO, Rank Math, All in One SEO, and The SEO Framework via their filter hooks (no duplicate tags). Also adds image alt and breadcrumb support, plus a new endpoint to receive AI-generated article drafts from Amplest cloud.

= 1.1.0 =
UI language is now English. Japanese translations are included via the bundled .po/.mo files. Plan names have changed to Free / Planner / Operator / Autopilot — existing licenses are automatically mapped to the new tiers. A rollback system has been added; no action required on your part.
