=== AI Visibility for WordPress ===
Contributors: piotrlitwa
Tags: llms.txt, ai, seo, markdown, json-ld
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Help AI assistants (ChatGPT, Claude, Gemini, Perplexity) find, understand and cite your posts and pages.

== Description ==

AI Visibility for WordPress connects your site to AI Visibility (AIV, https://aiv.piotrlitwa.com).

Free:

* `/llms.txt` — an index of your content for AI assistants. Served from AIV and cached for 6 hours. When AIV is unavailable (or the site is not connected yet), a local list of published posts and pages is served instead, so the URL never breaks.
* `/md/<slug>.md` — a clean Markdown copy of every published post and page.
* JSON-LD (`Article` for posts, `WebPage` for pages). Skipped automatically when Yoast SEO, Rank Math, SEOPress or All in One SEO is active — they already output structured data.
* "Analyze this page" in the editor — SEO, readability and AI-readiness (GEO) checks from AIV.

Pro (AIV Own Key plan — your own Claude, OpenAI or Gemini key):

* "Generate AI summary" in the editor: a short, factual summary (lead sentence + key points) → preview → Insert.
* Bulk action "Generate AI summary (AIV)" in the Posts and Pages lists (one item at a time, in your browser).

What "Insert" does: the summary is saved as the post's AI summary — it is shown at the top of the Markdown copy, used as the description in llms.txt and JSON-LD, and sent to AIV Studio. Your post content is never changed. Optionally (checkbox) the first sentence becomes the excerpt; the bulk action fills the excerpt only where it is empty.

Optional — "Let AIV change content" (AIV Own Key plan, off by default):

* When you ask Claude, ChatGPT or Gemini (through the AIV connector) to edit a post or page, AIV can save the change on your site: title, content, excerpt, SEO title and description, and image alt texts. Posts and pages only.
* You turn it on yourself in Settings → AI Visibility → "Let AIV change content", pick the WordPress account the changes are saved as and confirm. Turning it off removes the access immediately.
* A change goes live on your site as soon as you approve it in the chat. There is no draft step. Every change can be undone from the chat, and WordPress keeps its own revision of the post.
* Pages built with a page builder are refused (their content is not plain text). Content with scripts, iframes or other tags that WordPress's HTML filter strips is refused rather than saved altered. With All in One SEO active, the SEO title and description are refused (it keeps them in its own table). The plugin never touches a post that was edited by someone else since AIV read it. The access is protected by a secret that exists only on your site and at AIV, and every request is signed and valid for a few minutes.
* The card is shown only when your AIV account has this feature available or it is already turned on.

WooCommerce products are not handled by this plugin — use "Direct AI Visibility" for products. This plugin keeps working for posts and pages on shops too.

== External services ==

This plugin connects to AI Visibility (AIV), a service run by Piotr Litwa at https://aiv.piotrlitwa.com. Nothing is sent until you connect the site (Connect to AIV or a pasted site key), except the update check. What is sent, and when:

* Connect to AIV — your browser is sent to aiv.piotrlitwa.com/plugin-connect.php with this site's domain, the address of this settings page and a random one-time token. Afterwards WordPress exchanges the one-time code for the site key (server to server).
* Status (settings page, editor box; cached 10 minutes) — the site key, plugin version and WordPress version.
* llms.txt (when /llms.txt is requested and the 6-hour cache is empty) — the site key; AIV returns the llms.txt content.
* Analyze this page (only when you click it) — the title, description, content and URL of that post.
* Generate AI summary / bulk action (Pro, only when you click it) — the title, text and URL of that post; AIV sends it to the AI provider of YOUR AIV account (your own Claude, OpenAI or Gemini key).
* Insert / publishing a post with an AI summary — the post's title, URL, summary and Markdown copy, the site name and tagline; stored as a document in AIV Studio.
* Unpublishing, trashing or deleting a post that has an AI summary — the same data with status "draft", so AIV stops listing it in llms.txt.
* Let AIV change content (only when you turn it on) — the write secret and this site's REST address are sent to AIV once, when you turn it on; AIV then calls your site, never the other way round. When an assistant asks AIV to read a post, AIV reads its content, including drafts and private posts, and passes it to that assistant. AIV is told when you turn it off or disconnect. AIV keeps a log of which fields were changed, never the text itself.
* Update check (about every 12 hours, also when not connected) — the plugin and WordPress version, to aiv.piotrlitwa.com/api/plugin/version.php.

Terms of service: https://piotrlitwa.com/terms.html
Privacy policy: https://piotrlitwa.com/privacy.html

== Installation ==

1. Plugins → Add New → Upload Plugin → choose the ZIP downloaded from https://aiv.piotrlitwa.com/plugins.php → Install → Activate.
2. Settings → AI Visibility → "Connect to AIV" (or paste your site key manually).
3. Open https://your-site/llms.txt to check it works. /llms.txt and /md/ need pretty permalinks (Settings → Permalinks — anything but "Plain").

== Frequently Asked Questions ==

= What does the plugin send to AIV? =

See "External services" above.

= Who can generate AI summaries? =

Generating uses the site owner's AI key, so it needs the `publish_posts` capability (Authors, Editors, Administrators). Change it with the `aivv_generate_cap` filter. Contributors can still analyze posts.

= Testing against a local AIV =

Add to wp-config.php: `define('AIVV_AIV_URL', 'http://host.docker.internal:8098');`

== Changelog ==

= 1.1.0 =
* New: optional "Let AIV change content" — an AI assistant connected to AIV can edit the title, content, excerpt, SEO title and description and image alt texts of posts and pages after you approve the change in the chat. Off by default, signed requests, changes can be undone.
* The settings card is shown only when your AIV account has this feature available or it is already turned on.

= 1.0.0 =
* First release: llms.txt, Markdown copies, JSON-LD, Connect to AIV, page analysis, AI summaries (Pro), updates from AIV, English and Polish.
