=== ESMM Connector ===
Contributors: socialmediaassistant
Tags: seo, rest api, social media
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lets Endless Social Media Manager (ESMM) save SEO titles and descriptions through the REST API, and copies them into your SEO plugin.

== Description ==

ESMM publishes blog posts through the WordPress REST API. Core WordPress doesn't let the REST API write SEO fields, and Yoast SEO's own REST API is read-only, so this plugin:

* Registers `esmm_seo_title` and `esmm_seo_description` post meta, readable and writable through the REST API by anyone who can edit the post.
* Copies those values into Yoast SEO, Rank Math or All in One SEO whenever they change, if one of them is active.
* Without an SEO plugin, uses them as the page title and meta description on single posts.
* Registers `esmm_variant_id` post meta (visible only with `context=edit`), which lets the app find a post it already created if a publish is retried, so a post is never published twice.
* Adds `GET /wp-json/esmm/v1/health` for signed-in users who can edit posts. It reports the plugin version and the SEO plugin detected, and the app calls it when it checks the connection.

The plugin has no settings screen and stores nothing except the post meta above.

== Installation ==

1. In WordPress, go to Plugins > Add New > Upload Plugin.
2. Upload `esmm-connector-<version>.zip` (build it with `pnpm --filter @esmm/integrations zip:wordpress-plugin`).
3. Activate it.
4. In the Endless Social Media Manager, open Connections and check the blog connection. It should say which SEO plugin the fields are copied to.

== Frequently Asked Questions ==

= Which SEO plugins does it support? =

Yoast SEO (`_yoast_wpseo_title`, `_yoast_wpseo_metadesc`), Rank Math (`rank_math_title`, `rank_math_description`) and All in One SEO 4 or later, through its own data model.

= What happens if I edit the SEO title in Yoast afterwards? =

Your edit wins until the app saves the post's SEO fields again. The plugin only copies values when the app's fields change.

= Does it work with pages or custom post types? =

No. The app publishes posts, so only the `post` type gets the fields.

== Changelog ==

= 0.1.0 =
* First release: SEO meta over REST, copying into Yoast SEO, Rank Math and AIOSEO, the variant ID, and the health endpoint.
