=== Priizmo AI Summary & FAQ Schema ===
Contributors: priizmo
Tags: aeo, seo, ai engine optimization, schema, faq
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.4.4
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Optimize your WordPress content for AI search engines (ChatGPT, Perplexity, Google AI Overviews) with AI summaries and JSON-LD FAQ schema.

== Description ==

Traditional SEO focuses on ranking in Google search results. **AEO (AI Engine Optimization)** ensures your brand and content are properly crawled, understood, and cited by Large Language Models (LLMs) like ChatGPT, Claude, and Perplexity.

**Priizmo AI Summary & FAQ Schema** connects directly to your own OpenAI or Anthropic API keys to automatically generate the structured data AI models crave. Instead of spending hours manually writing summaries and coding schema markup, you can generate everything with the click of a button right inside the Gutenberg editor.

### Core Features

*   **AI-Powered TL;DR Summaries:** Generate concise, 2-3 sentence summaries and place them at the top of your articles so AI crawlers get the direct answer immediately.
*   **Automated FAQ & Schema Generation:** Automatically generate highly relevant Frequently Asked Questions based on your content, outputting both accessible HTML blocks and invisible JSON-LD FAQPage schema.
*   **Bring Your Own Key:** Connect directly to OpenAI or Anthropic using their latest models. You only pay fractions of a cent directly to the AI providers for usage, with no hidden markup fees.
*   **Lightning Fast Caching:** All generated summaries and FAQs are stored natively in your WordPress database to ensure zero impact on page load speeds.
*   **Flexible Display Options:** Automatically inject summaries above your content, before the first H2 tag, or place them manually using the `[priizmo_summary]` and `[priizmo_faq]` shortcodes.

This plugin connects to third-party services to function -- see "External services" below for full details on what is sent, when, and to whom.

== Installation ==

1. Upload the `priizmo-ai-summary-faq-schema` folder to the `/wp-content/plugins/` directory, or install the plugin directly through the WordPress plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. You will be greeted by a secure opt-in screen. You can choose to allow diagnostic tracking or skip it completely (the plugin works exactly the same either way).
4. Navigate to **Settings > Priizmo AI Summary & FAQ Schema** in your WordPress dashboard.
5. Enter your OpenAI or Anthropic API key and select your preferred model.
6. Open any Post, switch to Edit mode, and look for the "AEO Controls" panel -- in the block editor (Gutenberg) it appears in the right-hand sidebar; if you use the Classic Editor, it appears as a box in the right-hand column instead. Click "Generate AI Summary" or "Generate AI FAQs".

== External services ==

This plugin relies on the following third-party services to provide its core functionality. None of them are optional to the features described below -- if you don't want a given service contacted, don't use the corresponding feature (e.g. don't configure that provider's API key).

**OpenAI** -- used to generate the AI-powered TL;DR summary and FAQ content, if you've selected an OpenAI model (e.g. GPT-5.6) as your default model.

It sends your post's title and body text (stripped of HTML, truncated to a maximum of 12,000 characters) to OpenAI's API every time you click "Generate AI Summary" or "Generate AI FAQs" for a post (from the "AEO Controls" panel, or, in the Pro version, during a Bulk Processing run), using the OpenAI API key you provide in Settings. Nothing is sent automatically or in the background; it only happens when a generation request is actually made. This service is provided by OpenAI, L.L.C.: [Terms of Use](https://openai.com/policies/terms-of-use/), [Privacy Policy](https://openai.com/policies/privacy-policy/).

**Anthropic** -- used to generate the AI-powered TL;DR summary and FAQ content, if you've selected an Anthropic model (e.g. Claude Sonnet 5) as your default model.

It sends your post's title and body text (stripped of HTML, truncated to a maximum of 12,000 characters) to Anthropic's API every time you click "Generate AI Summary" or "Generate AI FAQs" for a post (from the "AEO Controls" panel, or, in the Pro version, during a Bulk Processing run), using the Anthropic API key you provide in Settings. Nothing is sent automatically or in the background; it only happens when a generation request is actually made. This service is provided by Anthropic PBC: [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), [Privacy Policy](https://www.anthropic.com/legal/privacy).

**Freemius** -- used to manage the plugin's licensing (for the separate Pro upgrade), update checks, and, only if you explicitly opt in on the opt-in screen shown after activation, anonymized diagnostic/usage data to help improve the plugin. Declining the opt-in does not limit any of this plugin's functionality.

It sends basic site data (e.g. site URL, WordPress/PHP version, and this plugin's version) to Freemius's servers on plugin activation and periodically afterward to check for updates and (for Pro users) validate license status; if you opt in on the diagnostic-tracking screen, it additionally sends anonymized usage data. It never sends any post content or the AI summaries/FAQs this plugin generates. This service is provided by Freemius Inc.: [Terms of Service](https://freemius.com/terms/), [Privacy Policy](https://freemius.com/privacy/).

== Screenshots ==

1. The AI-generated summary automatically displayed on a post.
2. The AI-generated FAQ section automatically displayed on a post, with matching JSON-LD FAQPage schema for AI search engines.
3. Generate an AI-powered TL;DR summary directly from the block editor with one click.
4. Generate AI-powered FAQs directly from the block editor with one click.
5. Customize the TL;DR and FAQ prompts sent to your AI provider.
6. Control where the summary appears on your site and customize its colors.

== Frequently Asked Questions ==

= Do I need to pay a monthly subscription to use this plugin? =
No. The core version of Priizmo AI Summary & FAQ Schema is completely free. However, because the plugin uses true AI to read your content, you will need to provide your own OpenAI or Anthropic API key. These services typically cost a few pennies per month for a standard blog.

= Will this slow down my website? =
Not at all. When the AI generates a summary or FAQ, the plugin saves the text directly into your WordPress database (`post_meta`). Your site never has to wait for an API call when a visitor loads a page.

= Does this replace traditional SEO plugins like Yoast or RankMath? =
No. This plugin works alongside your existing SEO plugins. While standard SEO plugins handle meta titles and sitemaps, this handles the unstructured text summarization and specific FAQ JSON-LD schema that AI chat models look for.

== Changelog ==

= 1.4.4 =
* Fixed Bulk Processing (and the single-post "Generate FAQ"/"Generate Summary" buttons) permanently failing with "The Anthropic API returned an empty response" on posts where Claude used extended thinking, even after exhausting all retries. The Messages API returns its response as an array of blocks, and a `thinking` block placed ahead of the actual answer was being mistaken for an empty response, when a valid summary/FAQ was actually present later in the same response. Retrying didn't help since this happened consistently for the same responses -- affected posts should now succeed on the first attempt.

= 1.4.3 =
* Fixed the free build still containing a Freemius SDK "Pro" marker string, which caused every commit to WordPress.org's SVN repository to be hard-rejected ("Commit Blocked: Your commit contains the Pro version of the Freemius SDK"). This marker is normally stripped automatically by Freemius's own build tooling, but this plugin's free/premium split is produced by its own build script, which didn't account for it. No functional change for existing installs; this only affects how the free distribution is packaged.

= 1.4.2 =
* Fixed a data-loss regression from 1.4.0's "aeo" -> "priizmo" prefix rename: sites upgrading from 1.3.2 or earlier appeared to have their API keys, custom prompts, and every already-generated summary/FAQ vanish, because those were stored under the old option/meta key names, which the renamed code no longer read. Added an automatic, one-time migration that carries existing settings and cached summary/FAQ data over to the new names the very first time the site loads after upgrading -- nothing is lost, and no action is needed. If you already re-entered settings or noticed empty Prompt Templates after updating to 1.4.0/1.4.1, updating to this version will restore your original saved values.

= 1.4.1 =
* Fixed Bulk Processing tending to hit the same "Overloaded"/empty-response transient AI provider errors repeatedly, on nearly every post in a run at once. Posts in a batch were all enqueued for immediate execution together, so a burst of many simultaneous AI requests could trip the provider's own rate/concurrency limits for the whole batch at once -- and since a failed post's retry is scheduled relative to when it failed, that burst repeated on every retry round too. Each post's start time is now staggered a few seconds apart, so requests to the AI provider stay spread out instead of arriving in one burst.

= 1.4.0 =
* Fixed a WordPress.org Plugin Review finding: the Freemius SDK (used for Pro licensing and update checks) was being loaded and initialized unconditionally on every page load, before any opt-in choice. Added a genuine plugin-side opt-in (Settings > Privacy & Licensing), off by default, that gates the SDK from ever loading at all until enabled -- no connection to Freemius or anyone else happens while it's off. Existing Pro customers are unaffected (the Pro build defaults this on, matching normal licensed-software expectations), but the setting can be freely changed either way.
* Fixed a WordPress.org Plugin Review finding: renamed every plugin-defined function, class, constant, option, shortcode, REST namespace, and hook from the generic 3-character "aeo"/"AEO" prefix to "priizmo"/"PRIIZMO" (7+ characters), to avoid conflicts with other plugins/themes. This includes the `[aeo_summary]`/`[aeo_faq]` shortcodes, now `[priizmo_summary]`/`[priizmo_faq]` -- if you placed either shortcode manually in a post, please update it to the new name. The Freemius product `slug` itself (an immutable identifier tied to this product's Freemius account, unrelated to the naming issue above) is unchanged.

= 1.3.2 =
* Fixed Bulk Processing's "X out of Y posts processed" total still growing during a single run even with the per-run tracking group added in 1.3.0. Every retried post (e.g. after a transient rate-limit/"Overloaded" error) added an extra tracked action alongside its original attempt, and the total was being computed by summing all of those raw records instead of the actual number of posts in the run. The total is now fixed to the post count recorded when the run started, and the succeeded/processed counts are derived from outstanding work instead of raw action-row counts, so retries no longer inflate either number.

= 1.3.1 =
* Fixed Bulk Processing's progress numbers (e.g. "50 out of 66 posts processed") appearing unrelated to the category shown in the dropdown. The dropdown/checkbox always reset to their defaults on page load and never reflected what an already-running batch was actually started with; the admin tab now shows which category (or "All Categories") and whether "Regenerate" the currently running batch actually covers.

= 1.3.0 =
* Added a "Cancel Current Run" button to Bulk Processing, so a slow or stuck-looking run can be stopped directly from the admin tab. Posts already processed keep their cached summary/FAQ; only still-queued work is canceled.
* Made the FAQ block's and summary box's typography and border color follow the active theme instead of a fixed generic look: heading font styling now comes from the theme's own h2/h3 rules, body text sizing matches the surrounding post content, and the FAQ item border blends toward the theme's own text color.

= 1.2.1 =
* Fixed Bulk Processing not retrying when Anthropic's API responds with an "Overloaded" (HTTP 529) error, its own equivalent of a temporary rate limit; this is now retried with backoff the same as a standard rate limit, instead of giving up after a couple of attempts.

= 1.2.0 =
* Improved the default FAQ prompt to prioritize the kinds of high-intent questions people actually ask AI search engines (deciding, planning, comparing, practical guidance), while still requiring every answer to be grounded in the post's own content.
* Added a "Regenerate Existing Content" option to Bulk Processing, so previously-processed posts can be reprocessed on demand (e.g. after updating a prompt or refreshing older content) instead of only filling in posts that have never been processed.
* Fixed Bulk Processing giving up permanently after a single attempt when the AI provider returned an empty response (a transient issue, most noticeable during larger bulk runs); this is now retried with backoff like a rate limit, and the logged error now includes the provider's reported reason for easier diagnosis if it recurs.

= 1.1.0 =
* Renamed the plugin to Priizmo AI Summary & FAQ Schema, per WordPress.org Plugin Review feedback on the previous name/slug.
* Added a Classic Editor fallback: the "AEO Controls" panel now also appears as a meta box on the post edit screen when the block editor isn't in use, so Generate Summary/FAQ works regardless of which editor your site uses.
* Fixed Bulk Processing giving no visible feedback when started, which could lead to accidentally starting it twice; a run in progress is now clearly indicated and a second run is blocked until the first finishes.
* Fixed the Default Model list containing retired AI provider model IDs; updated to the current supported models for both OpenAI and Anthropic.
* Fixed FAQ generation silently producing nothing for longer AI responses that exceeded the output token limit; increased the limit for FAQ generation and added clear error reporting (in both Bulk Processing and the "AEO Controls" panel) when generation genuinely fails.
* Added clear on-screen instructions for using the plugin (Settings page) and confirmation that Bulk Processing continues safely in the background if you navigate away.
* Made JSON-LD FAQPage schema output unconditionally available (it's never been gated behind Bulk Processing's Pro upgrade).
* Replaced the free-text "Custom Summary Box CSS" setting with two color pickers (background and accent color), removing the ability to enter arbitrary CSS.
* Added a full "External services" disclosure (what's sent to OpenAI, Anthropic, and Freemius, when, and links to each provider's terms and privacy policy).
* Renamed an internal constant (WP_FS__IS_PREMIUM_CODE) that used a "wp"-style prefix to AEO_ENGINE_IS_PREMIUM_CODE.
* Removed the "Plugin URI" header, which was identical to "Author URI" and rejected by the WordPress.org submission form for that reason.

= 1.0.0 =
* Initial public release on the WordPress repository.
* Added native Gutenberg sidebar integration.
* Added support for OpenAI (GPT-4o) and Anthropic (Claude 3.5 Sonnet).
* Added automatic JSON-LD FAQPage schema generation.
