=== Writer GPT Publisher ===
Contributors: thedoersfirm
Author: Writer GPT
Author URI: https://writer-gpt.com
Plugin URI: https://writer-gpt.com/wordpress-integration
Tags: ai, publishing, automation, seo, sync
Requires at least: 6.2
Tested up to: 7.0
Stable tag: 2.8.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Auto-publish AI-generated articles from your Writer GPT account to this WordPress site. Requires a free or paid Writer GPT account.

== Description ==

**Author:** Writer GPT — https://writer-gpt.com
**Ownership contact:** mts@writer-gpt.com
**Plugin homepage:** https://writer-gpt.com/wordpress-integration


Writer GPT Publisher is the companion plugin for [writer-gpt.com](https://writer-gpt.com). When you click *Publish* in Writer GPT, this plugin receives the article on your WordPress site and creates the post for you, with featured images and SEO meta automatically applied.

= Features =

* Automatic sync — articles you publish in Writer GPT are pushed to this site.
* Featured image + inline images downloaded into the Media Library (with size and compression controls).
* SEO meta written for Yoast SEO, Rank Math, and All in One SEO when those plugins are active.
* Draft-vs-publish choice, category & author defaults, slug control.
* Duplicate-publish protection: the same job is never published twice, even on push + cron overlap.
* Activity log and connection-health panel inside the WordPress admin.

= Account required =

A free or paid Writer GPT account is required, because the AI content is created on the Writer GPT cloud and pushed to this site. Sign up at [writer-gpt.com](https://writer-gpt.com/).

== External services ==

This plugin connects to the Writer GPT cloud service. It does not call any other third-party service.

**Service:** Writer GPT API (operated by Writer GPT)
**Endpoint:** `https://npfnholmepecjiepradj.supabase.co/functions/v1/plugin-pull-jobs` and `/plugin-ack-job`

**What is sent, and when:**

* When you click *Verify Connection*: your plugin token, this site's URL, and the plugin version, so the service can confirm pairing.
* When the plugin pulls jobs (push notification or scheduled cron, default every 30 seconds when enabled): the plugin token and a request for any pending articles assigned to this site.
* When a job is processed: a small acknowledgement containing the job ID, whether publish succeeded, and the resulting WordPress post ID — so the same article is never resent.

The plugin does **not** transmit visitor data, comments, existing posts, user accounts, or any data outside of the items above.

**Terms & privacy:**

* Terms of Service: [https://writer-gpt.com/terms-of-service](https://writer-gpt.com/terms-of-service)
* Privacy Policy: [https://writer-gpt.com/privacy-policy](https://writer-gpt.com/privacy-policy)

By connecting your Writer GPT plugin token, you agree to those Terms and Privacy Policy.

== Privacy ==

Activity logs, connection status, and the encrypted plugin token are stored in this site's `wp_options` table. The plugin does not place tracking pixels, cookies, or analytics on your public site. Outgoing connections are made only to the Writer GPT endpoints listed above.

== Installation ==

1. Upload the `writer-gpt-com` folder to `/wp-content/plugins/` (or install the ZIP via Plugins → Add New → Upload Plugin).
2. Activate "Writer GPT Publisher" from the Plugins screen.
3. Go to **Writer-GPT** in the admin menu and paste the plugin token from your Writer GPT dashboard (Publish to WordPress → Sites).
4. Click *Verify Connection*. You're done — new articles will appear automatically.

== Frequently Asked Questions ==

= Where do I find my plugin token? =

Log in to writer-gpt.com, open *Publish to WordPress* → *Sites*, and copy the token shown for this site.

= Do articles publish automatically? =

Yes, unless you toggle the *Save as draft* option in Content Settings.

= Does this work with my SEO plugin? =

Yes — Yoast SEO, Rank Math, and All in One SEO meta titles and descriptions are written automatically when those plugins are active.

= How often does the plugin check for new articles? =

The plugin receives push notifications from Writer GPT instantly. A fallback cron checks every 30 seconds when push delivery is unavailable.

= Can I use this plugin without a Writer GPT account? =

No. A Writer GPT account is required because content is generated on the Writer GPT cloud.

== Screenshots ==

1. Connection panel with token, verify button, and connection status.
2. Stats dashboard (total published, pending, today, this week).
3. Jobs / activity log with per-article status and error reasons.
4. Image, Content, and Advanced settings tabs.
5. WordPress dashboard widget showing sync status at a glance.

== Changelog ==

= 2.8.1 =
* COMPLIANCE: Replaced the deprecated `who => 'authors'` argument in `get_users()` with the modern `capability => array('edit_posts')` equivalent (deprecated since WordPress 5.9). Fixes a deprecation notice on the plugin settings page. No functional changes.

= 2.8.0 =
* COMPLIANCE: Plugin Check fixes — added a translators comment on the pluralized decay-alert string, switched `parse_url()` to `wp_parse_url()`, and removed the prohibited `suppress_filters` argument from internal post lookups. No functional changes.

= 2.7.9 =
* COMPLIANCE: Clarified plugin ownership metadata for WordPress.org review — added explicit Author, Author URI, Plugin URI, and an ownership contact on the plugin's own domain (mts@writer-gpt.com). No functional changes.

= 2.7.8 =
* COMPLIANCE: WordPress.org review fixes — corrected the `Contributors` username, renamed the plugin text domain to match the slug (`writer-gpt`), escaped every translated string at output using `esc_html_e` / `esc_html__` / `esc_attr`, and prefixed the settings option (`writer_gpt_publisher_settings` → `wgpt_settings`) and main class (`Writer_GPT_Publisher` → `WGPT_Publisher`).
* MIGRATION: One-time automatic upgrade copies the legacy option value into the new key on activation, so existing sites keep their plugin token and settings.
* No functional changes to publishing, cron, REST, or image handling.

= 2.7.7 =
* NEW: Autopilot now scans WordPress Posts by default. Pages are opt-in via the new "Also monitor WordPress Pages" setting — for pages we only recommend content (copy &amp; paste manually) to avoid conflicts with page builders like Elementor, Beaver, etc.
* UI: WordPress activity list now shows "Updated" (blue) for refresh jobs and "Published" (green) for new posts.
* FIX: Autopilot "Refreshed" tab now includes recently-updated content, and the "Refresh status" button re-syncs job + task state with a visible spinner.

= 2.7.6 =
* UI: "SEO Copilot" now appears as a submenu under the main "Writer-GPT" menu instead of a separate top-level menu.
* FIX: Refresh publish jobs now preserve update target metadata from the queue, so SEO Agent refresh approvals update the existing WordPress post instead of being treated as new publishes.
* UI: Refresh approvals are labeled "Update Content" while new article approvals are labeled "Publish".

= 2.7.4 =
* FIX: Refresh/update jobs now resolve the target post by `existing_wp_post_id`, then `source_url` (via `url_to_postid` and slug lookup) before publishing. If no post can be located, the job aborts instead of silently creating a duplicate.
* IMPROVEMENT: `source_url` is now accepted on update jobs as a safety-net match key.


= 2.7.3 =
* FIX: Packaging — ZIP now ships the `includes/class-wgpt-seo-copilot.php` module file that was missing in 2.7.2, which prevented activation on fresh installs.
* HARDENING: Main plugin file now loads the SEO Copilot module defensively, so a missing module file shows an admin notice instead of a fatal error.

= 2.7.2 =
* COMPLIANCE: Bumped "Tested up to" to WordPress 7.0 per WP.org review.

= 2.7.1 =
* COMPLIANCE: Removed the `Update URI` header (not allowed for plugins hosted on WordPress.org).
* COMPLIANCE: Bumped "Tested up to" to WordPress 6.8.

= 2.6.3 =
* COMPLIANCE: First-run admin disclosure notice covering the Writer GPT cloud connection.
* COMPLIANCE: External-services disclosure added to readme and settings UI.
* HEADERS: GPLv2-or-later normalized, `Update URI: false`, `Tested up to: 6.7`, `Requires at least: 6.2`, dedicated Plugin URI for the integration landing page.
* SECURITY: Nonce-protected dismiss action for the disclosure notice.

= 2.6.2 =
* Hardened duplicate-publish protection: jobs are claimed with a row-level lock so push + cron overlap can never publish the same article twice.
* More aggressive ACK on partial failures so the queue advances cleanly.

= 2.6.1 =
* Better failure reasons surfaced in the activity log (network, auth, image, SEO).
* Improved cron rescheduling after WP-Cron downtime.

= 2.6.0 =
* NEW: Stealth BYOK compatibility — recognizes the `STEALTH_BYOK_REQUIRED` response and surfaces a clear, actionable message instead of a generic API error.
* NEW: Connection status reports `byok_required` so the Writer GPT dashboard can prompt you to add your Gemini API key.
* NEW: Gracefully handles jobs that arrive without a featured image when the source plan requires BYOK (logs an info line instead of treating it as a failure).

= 2.5.0 =
* Featured-image reliability: JPEG compression and dimension guards before upload.
* Always-on featured-image diagnostics logging.
* Featured-image errors now reported back in the job ACK so the dashboard shows the actual reason.
* Content-image fallback when an article has no dedicated featured image.
* SmallMode retry path for oversized thumbnails (800×800).

= 2.2.1 =
* Added Image Settings, Content Settings, and Advanced settings tabs.
* Hosted-URL image delivery to avoid large payloads.
* Better retries / timeouts and optional debug logging.

= 2.0.0 =
* Complete redesign, push notifications for instant sync, stats dashboard, All in One SEO support, auto-publish toggle.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 2.8.1 =
Fixes a WordPress 5.9+ deprecation notice on the plugin settings page by replacing the deprecated `who` argument in `get_users()` with the modern `capability` equivalent. No behavior changes.

= 2.8.0 =
Plugin Check compliance fixes: translators comment on pluralized string, wp_parse_url() in place of parse_url(), removed prohibited suppress_filters from internal post lookups. No behavior changes.

= 2.7.9 =
Ownership metadata clarified for WordPress.org review — Author, Author URI, Plugin URI, and an ownership contact on writer-gpt.com added. No behavior changes.

= 2.7.8 =
WordPress.org compliance pass: contributor name, text-domain rename, output escaping, and prefixed option/class names. One-time automatic migration preserves your saved plugin token.

= 2.7.6 =
Required for SEO Agent refreshes: update jobs now preserve target metadata and update existing WordPress posts instead of creating duplicates.

= 2.7.3 =
Critical fix: re-download required. The 2.7.2 ZIP was missing the SEO Copilot module file and could not activate. 2.7.3 ships it and adds a safety check so this can never brick activation again.

= 2.7.2 =
WordPress.org compliance: bumped "Tested up to" to WordPress 7.0. No behavior changes.

= 2.7.1 =
WordPress.org compliance: dropped the disallowed `Update URI` header and updated the "Tested up to" version. No behavior changes.

= 2.6.3 =
WordPress.org compliance pass. Adds a one-time disclosure notice and tightened plugin headers. No behavior changes for existing sites.

= 2.6.2 =
Recommended for everyone: prevents duplicate publishing when push and cron overlap.
