=== Serpwright ===
Contributors: serpwright
Tags: seo, content, publishing, indexnow, schema
Requires at least: 5.9
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Publish articles from Serpwright to WordPress with their SEO title, meta description, featured image and structured data.

== Description ==

Serpwright finds the searches your site should rank for, writes the pages, and publishes them after you approve. This plugin is the WordPress side of that connection.

* **One-time pairing.** Generate a code under Settings → Serpwright and enter it in Serpwright. No passwords are shared; the site stores only a hash of the connection token.
* **Publishes posts** with title, slug, excerpt, categories, tags and the featured image downloaded from the article's cover.
* **SEO fields.** Writes the SEO title, meta description and focus keyword to Yoast SEO, Rank Math or All in One SEO when one is active. Without an SEO plugin, Serpwright prints the title tag, meta description and Open Graph tags itself.
* **Structured data.** Prints the article's JSON-LD (FAQPage, HowTo, Product and more). When an SEO plugin already outputs Article and Breadcrumb schema, only the extra types are added.
* **IndexNow.** Hosts your IndexNow key file at /{key}.txt so Bing and other engines can be notified the moment a post goes live.
* **Sitemap detection.** Reports your sitemap (WordPress core, Yoast, Rank Math or AIOSEO) to Serpwright for Search Console resubmission.
* **Check-ins.** After pairing, twice a day, when you open the settings page (at most hourly) and on disconnect, the plugin reports its status to Serpwright so the app can show whether the connection is healthy.
* **Safe retries.** Publishing the same article twice updates the existing post instead of creating a duplicate.

== Installation ==

1. Upload the `serpwright` folder to `/wp-content/plugins/`, or upload the zip under Plugins → Add New → Upload.
2. Activate the plugin.
3. Go to Settings → Serpwright and click "Generate pairing code".
4. In Serpwright, open Settings → Publishing → WordPress, choose Plugin, and enter your site URL and the code.

Permalinks must not be set to "Plain" (the REST API lives at /wp-json/).

== Frequently Asked Questions ==

= Which user are posts published as? =

The administrator who generated the pairing code.

= What happens if I disconnect? =

The connection token is deleted. Published posts stay exactly as they are.

= What does uninstalling remove? =

The plugin's settings and its own post meta (keys starting with `_serpwright_`). Your posts, images and SEO plugin fields are kept.

= What does the plugin send to Serpwright? =

Only when paired: your site URL, the plugin and WordPress versions, the detected SEO plugin and your sitemap URL, signed with the connection token. It is sent to the Serpwright address that paired the site.

= My host strips the Authorization header. =

The plugin also accepts the token in an `X-Serpwright-Token` header, which Serpwright always sends.

== Changelog ==

= 1.1.0 =
* Live post sync: a new `GET /post/{id}` route lets Serpwright read a post back (content, title, status, last modified), and publish/update responses include the same. Serpwright uses it to avoid overwriting edits made in WordPress and to notice posts that were unpublished or deleted.
* Authors: posts are attributed to the WordPress user mapped to the article's Serpwright author (Settings, Authors in Serpwright). A missing or unsuitable user keeps the default author and returns a warning.
* New token-protected `GET /serpwright/v1/users` lists users who can publish posts (id, display name, nicename), for that mapping.

= 1.0.1 =
* Sitemap detection: report the Yoast or Rank Math sitemap only when its sitemap feature is on; otherwise WordPress core's.
* Deactivating the plugin now removes the IndexNow key rewrite rule.
* A wrong pairing code answers 401, like every other rejected credential.
* Settings page: connection steps match the current Serpwright screens.

= 1.0.0 =
* First release: pairing, publish and update endpoints, status callbacks to Serpwright, SEO plugin fields, JSON-LD, IndexNow key hosting, sitemap detection.
