=== Grandranker ===
Contributors: grandranker
Tags: seo, ai, content, publishing, articles
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically publish and update SEO-optimized articles from Grandranker — the AI content platform that helps you rank higher on Google and AI search engines.

== Description ==

[Grandranker](https://grandranker.com) is an AI-powered SEO platform that researches your niche, generates high-quality articles optimized for both traditional search engines and AI search (Google AI Overviews, ChatGPT, Perplexity, Claude, Gemini), and publishes them directly to your WordPress site.

This plugin connects your WordPress site to Grandranker so articles flow straight from the platform into your blog — no copy-pasting, no manual formatting.

**What Grandranker does for you:**

* Researches keywords and competitors in your niche
* Generates long-form, SEO-optimized articles with structured data (JSON-LD schema)
* Tracks your visibility across Google and AI search engines
* Publishes and updates articles on your WordPress site automatically

**How the plugin works:**

1. Install and activate the plugin.
2. Enter your Grandranker API token in **Grandranker** settings.
3. Click **Save & Connect**.
4. Articles published in Grandranker appear on your WordPress site automatically — with content, featured images, categories, tags, meta descriptions, and structured data all handled for you.

**Plugin features:**

* Secure HMAC-SHA256 signature verification on every request
* Creates and updates WordPress posts with title, slug, content, excerpt, tags, and featured image
* Injects JSON-LD structured data (schema markup) into page head for SEO
* Writes meta descriptions to Yoast SEO, Rank Math, or All in One SEO (auto-detected)
* Configurable default author and post status (Publish / Draft / Pending Review)
* Heartbeat-based delivery polling for near-instant publishing
* Unpublish endpoint to remove articles remotely
* Diagnostics panel with a manual "Test Poll Now" button
* One-click Disconnect that removes all stored credentials

== Third-Party Service ==

This plugin connects your WordPress site to the **Grandranker API** at `https://app.grandranker.com` to receive articles, schema markup, and delivery payloads from your Grandranker account.

Data is sent to and received from Grandranker servers when you:

* Click **Save & Connect** — your API token is sent in the `Authorization: Bearer` header to exchange it for an HMAC signing secret.
* Receive an article — Grandranker POSTs the article payload (title, content, schema, image URL, tags) to `/wp-json/grandranker/v1/articles` on your site, signed with `X-Grandranker-Signature` (HMAC-SHA256).
* Poll for queued deliveries — the plugin periodically (via WP-Cron and the WordPress Heartbeat API while admin is open) requests `/api/v1/plugin/deliveries` from Grandranker to fetch any pending articles.
* Click **Test Poll Now** or **Disconnect** in plugin settings.

No analytics, page content, or visitor data is sent to Grandranker. Only the site URL and authenticated requests for your own articles are transmitted.

* [Grandranker Website](https://grandranker.com)
* [Terms of Service](https://grandranker.com/terms)
* [Privacy Policy](https://grandranker.com/privacy-policy)

== Installation ==

1. Upload the `grandranker` folder to the `/wp-content/plugins/` directory, or install the plugin through the **Plugins → Add New** screen.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **Grandranker** in the WordPress admin sidebar.
4. Enter your API token from the Grandranker dashboard (**Integrations → WordPress Plugin**).
5. Click **Save & Connect**.

== Frequently Asked Questions ==

= Where do I find my API token? =

Log in to [Grandranker](https://app.grandranker.com), open your domain, and go to **Integrations → WordPress Plugin**. Generate a token and paste it into the plugin settings.

= Is the connection secure? =

Yes. All article pushes are signed with HMAC-SHA256. The signing secret is exchanged once during the initial connection and never transmitted again. Every incoming request is verified before any content is created.

= What happens when I publish an article in Grandranker? =

The article is sent to your WordPress site via a signed REST API call. The plugin creates a new WordPress post with the title, slug, HTML content, excerpt, meta description, tags, featured image, and JSON-LD structured data. Re-publishing the same article updates the existing post instead of duplicating it.

= Which SEO plugins are supported? =

Yoast SEO, Rank Math, and All in One SEO are auto-detected and the meta description is written to whichever is active. You can also pick the target plugin manually in settings, or disable SEO-plugin integration entirely.

= Can I publish as Draft or Pending instead of Publish? =

Yes. In **Grandranker → Settings**, set **Post status** to Draft or Pending Review and incoming articles will be created in that state.

= Can I unpublish articles from Grandranker? =

Yes. Grandranker can send a delete request to move the WordPress post to the trash.

= How do I disconnect? =

Open **Grandranker** in the admin sidebar and click **Disconnect**. The plugin removes the stored token, signing secret, and all related settings.

= Will uninstalling delete my synced posts? =

No. Only the plugin's settings are removed. Your synced posts, images, and schema stay in place.

== Changelog ==

= 1.1.0 =
* New: HMAC-signed push delivery — Grandranker now publishes directly to your site via a signed REST endpoint, replacing the previous pull-based sync.
* New: Configurable default author and post status (Publish / Draft / Pending Review).
* New: Auto-detected meta-description integration with Yoast SEO, Rank Math, and All in One SEO (override available in settings).
* New: Article tags are now applied to WordPress posts on publish.
* New: WordPress category mapping on publish — converts the article's category slug to a real WP category, creating it if needed.
* New: Diagnostics panel and "Test Poll Now" button in plugin settings.
* New: WordPress Heartbeat API polling for near-instant delivery while admin is open.
* New: One-click **Disconnect** action that removes all stored credentials and stops polling.
* Improved: JSON-LD schema is stripped from post content and injected via `wp_head` instead.
* Improved: Re-publishing an article now updates the existing WordPress post instead of skipping it.
* Improved: Duplicate-post protection via a 60-second global poll lock and `_grandranker_id` post-meta dedup.
* Note: Existing 1.0.x users will need to re-enter their API token after upgrading — the connection model has changed from pull-based sync to signed push delivery.

= 1.0.2 =
* Updated plugin description to better reflect Grandranker's full platform: Local SEO, e-commerce content, multi-language, keyword research, AI search visibility, and GEO audit.
* Documented all schema types generated for synced posts (Article, BlogPosting, FAQPage, HowTo, Product).
* Cleaner Plugin Features section, simpler setup steps, and a Privacy section.

= 1.0.1 =
* Fixed: YouTube, Vimeo, Loom, and Wistia iframe embeds were stripped from synced article content.
* Fixed: Featured image upload failed on hosts without the PHP `fileinfo` extension.
* Improved: Longer HTTP timeouts for long-form articles and slower hosts.
* Improved: Prevent duplicate posts when manual sync and auto-sync run on the same article simultaneously.

= 1.0.0 =
* Initial release
* Article sync from Grandranker API
* JSON-LD schema injection
* Yoast SEO and Rank Math meta integration
* Hourly auto-sync via WP-Cron
* Featured image sideloading
* Author and category mapping

== Upgrade Notice ==

= 1.1.0 =
Major update: the plugin now uses signed push delivery for near-instant publishing. After upgrading, open **Grandranker** in the admin sidebar and re-connect with your API token to resume publishing.
