=== Abency Connector ===
Contributors: guillemginer
Tags: seo, content workflow, editorial, approval, ai
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect your site to Abency so AI-proposed edits to already-published content wait for a human to preview and approve here, inside WordPress.

== Description ==

Abency Connector links your WordPress site to your agency's Abency workspace
(a hosted platform for digital agencies). It is a companion plugin: it does
nothing on its own and requires an Abency account to be useful.

**How it works**

* New content and drafts are created directly in WordPress (`wp_insert_post`).
  Nothing is published automatically — new items always start as drafts.
* Changes to **already-published** content are never applied live. Abency sends
  them here as **pending proposals**. A site editor reviews each proposal,
  previews it on the real theme, and then approves or rejects it from wp-admin.
* On approval, the change is merged onto the **original** post — same ID, same
  URL, same menus. Nothing is duplicated and no permalinks change.

**Why a plugin instead of the REST API**

Many managed hosts strip the `Authorization` header before it reaches PHP, which
breaks WordPress core REST authentication and Application Passwords. This plugin
uses its own `X-Abency-Token` header (issued during pairing) so it keeps working
on those hosts, and it writes content directly with WordPress core functions — no
Application Password required.

**Authentication**

Pairing uses a one-time code generated in Abency. No passwords are shared: Abency
mints two scoped tokens during pairing (one to authorize incoming requests to this
plugin, one for this plugin's status callbacks back to Abency). You can unpair at
any time from the plugin screen, which deletes the stored tokens.

**SEO**

When Yoast SEO or Rank Math is active, the plugin reads and writes the SEO title,
meta description and focus keyword for the posts it manages.

== External services ==

This plugin connects to **Abency**, a third-party SaaS platform, and does not
function without an Abency account. It communicates with the Abency instance whose
URL you enter when pairing (for the hosted service this is `https://app.abency.com`;
agencies may self-host at a different URL, which you provide during pairing).

The plugin talks to Abency in these cases:

* **When you pair the plugin** (you click "Pair"): it sends the pairing code you
  entered and this site's URL (`home_url()`) to Abency's pairing endpoint, and
  receives back the two scoped access tokens plus the paired brand identifier.
* **When you approve or reject a proposal**: it sends the resulting status
  (`applied` or `rejected`) and an optional note to the callback URL that Abency
  provided during pairing.

The plugin does **not** send any site data to Abency in the background or on a
schedule. Incoming requests from Abency (creating drafts, sending proposals) are
initiated by Abency and authenticated with the token issued during pairing.

Please review Abency's privacy policy and legal notice before pairing:

* Privacy Policy: https://abency.com/privacy-policy
* Legal notice: https://abency.com/aviso-legal

== Installation ==

1. Upload the `abency-connector` folder to `/wp-content/plugins/`, or install the
   zip from **Plugins → Add New → Upload Plugin**, then activate it.
2. In Abency, open **Brand → Integrations → WordPress → Pair plugin** to generate a
   one-time pairing code.
3. In WordPress, open the **Abency** menu, enter your Abency URL and the pairing
   code, and click **Pair**.

== Frequently Asked Questions ==

= Does this plugin publish content automatically? =

No. New content is always created as a draft, and changes to published content are
held as proposals that a human approves inside WordPress before they go live.

= Do I need an Abency account? =

Yes. This is a companion plugin for the Abency platform and has no standalone
functionality.

= Do I need a WordPress Application Password? =

No. The plugin runs inside WordPress and writes content with core functions, so no
Application Password or extra server configuration is required.

= What happens when I approve a proposal? =

The proposed fields are merged onto the original published post (same ID, URL and
menus). The change is not a new post and no permalink changes.

= How do I disconnect? =

Open the Abency menu and click **Unpair**. This deletes the stored tokens. To
remove all data, delete the plugin — its options and the proposals table are
removed on uninstall.

== Changelog ==

= 0.1.0 =
* Initial release: pairing, REST endpoints for content and terms, Yoast/Rank Math
  SEO bridge, proposal receiver, pending queue with theme preview, approve/merge
  and reject with status callback.

== Upgrade Notice ==

= 0.1.0 =
Initial release.
