=== MEGA AI ===
Contributors: MEGA
Tags: seo, ai, automation, content management, api
Requires at least: 4.4
Tested up to: 6.8
Stable tag: 2.55.4
Requires PHP: 7.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Plugin URI: https://gomega.ai

Connect your WordPress website to MEGA's AI-powered SEO platform for automated content optimization and growth.

== Description ==

MEGA is an AI-powered growth platform that automates SEO and content management for your WordPress website. This plugin enables MEGA's AI agent "Lindsay" to manage your content, optimize for search engines, and continuously improve your site's performance - all without manual intervention.


**Get started at [gomega.ai](https://gomega.ai/seo)**

= What MEGA Does =

MEGA provides a fully managed SEO service that automates end-to-end SEO processes, delivering enterprise-level optimization at a fraction of the cost. Our AI agents work 24/7 to research, strategize, and execute SEO tasks that typically require a full marketing team.

= Key Benefits =

* **AI-Powered Content Creation**: Automatically generates and publishes SEO-optimized content
* **Continuous Optimization**: Real-time content updates based on Google Search Console data
* **Technical SEO Automation**: Automated audits, fixes, and performance improvements
* **Keyword Research & Strategy**: AI-driven keyword discovery and implementation
* **Link Building**: Automated backlink acquisition and management
* **Conversion Rate Optimization**: Improves user engagement and conversions
* **Local SEO**: Optimizes for local search visibility
* **LLM Placement**: Optimizes content for AI search engines and featured snippets

= How It Works =

1. Install and activate the MEGA plugin
2. Connect your WordPress site to MEGA's platform
3. Our AI agent Lindsay begins analyzing your site
4. Content is automatically created, optimized, and published
5. Continuous monitoring and optimization improve results over time

= Features =

* **Secure Authentication**: Military-grade encryption ensures only authorized MEGA agents can access your site
* **Full Content Management**: Create, update, and optimize posts automatically
* **SEO Plugin Integration**: Works seamlessly with Yoast SEO, Rank Math, and All in One SEO (AIOSEO)
* **Autopilot Mode**: 85% of users enable full automation for 2x faster results
* **Multi-Platform Support**: Integrates with 50+ platforms beyond WordPress
* **Performance Tracking**: Comprehensive analytics and reporting
* **Human Oversight**: Complex tasks reviewed by SEO experts when needed

= Expected Results =

Most users see organic traffic growth within 3 to 9 months. MEGA's AI continuously learns and improves, providing ongoing optimization that adapts to search engine changes.

Learn more on our [website](https://gomega.ai/seo).

== External Services ==

This plugin connects to MEGA's external service to provide AI-powered SEO optimization for your WordPress website.

= MEGA SEO Platform =

The plugin communicates with MEGA's platform (gomega.ai) to enable automated SEO optimization and content management. This connection is essential for the core functionality of the plugin.

**What data is sent**: The plugin sends website content, metadata, and site configuration information to MEGA's platform for analysis and optimization.

**When data is sent**: Data is transmitted when MEGA's AI agents perform content creation, updates, or SEO optimization tasks on your behalf.

**Purpose**: This data exchange enables MEGA's AI to analyze your site, generate SEO-optimized content, track performance, and continuously improve your website's search engine rankings.

**Service provider**: [MEGA](https://gomega.ai) (gomega.ai)
[Terms of Service](https://www.gomega.ai/legal/terms-of-use)
[Privacy Policy](https://www.gomega.ai/legal/privacy-policy)

= WordPress.org core checksums =

The file-integrity check calls `api.wordpress.org` (through WordPress core's own `get_core_checksums()` function) to download the official checksums for your WordPress version and language. No site data is sent to WordPress.org beyond that request. The plugin compares the checksums with your core files locally, then reports the paths, sizes, modified times and md5 hashes of any differing or unexpected files (never file contents) to MEGA's platform. Set `MEGA_DISABLE_INTEGRITY` in `wp-config.php` to disable this check.

= Security activity reports =

For administrator-level accounts, the plugin reports security-relevant activity to MEGA's platform (api.gomega.ai) so a compromised account is noticed: logins, plugin installs, activations and deactivations, new administrator accounts and role changes, posts created through the REST API, changes to the default user role and to a few code-injection settings, and edits made in the plugin and theme file editors. Each event carries the account's login name, a SHA-256 hash of its email address, the network part of the visitor's address (the first three bytes of an IPv4 address or first six of an IPv6 address; never the full address), and a coarse browser type. File contents, option values and passwords are never sent. The last seven days of events are also kept in the site database and returned on MEGA's daily file-integrity check.

The file-integrity check also reports which administrator accounts exist (ID, registration date, email domain and hash), hashes of the active theme's PHP files, and hashes of a few code-injection settings and code-snippet entries, never their contents.

By using this plugin, you acknowledge that your website data will be processed by MEGA's platform in accordance with their terms of service and privacy policy.

== Installation ==

1. Create your MEGA account at [gomega.ai](https://gomega.ai/pricing)
2. Upload the `mega-ai` folder to the `/wp-content/plugins/` directory
3. Activate the plugin through the 'Plugins' menu in WordPress
4. In your MEGA dashboard, add new feed from media accounts and select WordPress
5. Our agents will automatically connect to your WordPress site and begin optimization

== Configuration ==

After creating your MEGA account and installing this WordPress plugin, our agents will automatically be able to access your WordPress and optimize it.

No manual configuration required - just install the plugin and our AI agents handle the rest!

== Frequently Asked Questions ==

= What is MEGA? =

MEGA is an AI-powered SEO platform that uses intelligent agents to automate your entire SEO strategy. Our AI agent "Lindsay" handles keyword research, content creation, technical SEO, link building, and continuous optimization - delivering results that typically require a full marketing team.

= How much does MEGA cost? =

MEGA's SEO service starts at $999/month (or $799/month billed annually). This includes full SEO automation, unlimited content updates, and all features. Learn more at https://gomega.ai/pricing

= Is this plugin secure? =

Yes, the plugin uses military-grade RSA encryption with public/private key cryptography. Only MEGA's authorized AI agents can access your site, and all communications are cryptographically signed and verified.

= What can MEGA's AI do with my WordPress site? =

MEGA can:
- Create new SEO-optimized blog posts and pages
- Update existing content based on performance data
- Optimize meta titles and descriptions
- Fix technical SEO issues
- Manage internal linking
- Track and improve keyword rankings
- Monitor competitor strategies
- And much more, all automatically

= Does it work with my SEO plugin? =

Yes, MEGA seamlessly integrates with Yoast SEO, Rank Math, and All in One SEO (AIOSEO), enhancing rather than replacing their functionality.

= How long until I see results? =

Most users see organic traffic growth within 3 to 9 months. MEGA works continuously, and results compound over time as the AI learns your market and optimizes your content.

= Can I review content before it's published? =

Yes! You can choose between full autopilot mode (85% of users) for fastest results, or review mode where you approve content before publication.

= Will it affect my site's performance? =

No, the plugin is lightweight and only adds a small optimization script. All heavy processing happens on MEGA's servers, not your WordPress site.

= Can I use this with other CMS platforms? =

Yes, MEGA supports 50+ platforms including Shopify, Webflow, Wix, HubSpot, and more. This plugin is specifically for WordPress integration.

== Changelog ==
= 2.55.4 =
* Fix: a hand-formatted HTML widget can take one new inert slide when the slide arrives with its own line break and indentation beside it, as the widget's other slides are laid out. Only blank space is added beside the slide; every other byte stays as it was.

= 2.55.3 =
* Fix: a hand-formatted HTML widget (a carousel whose slides are separated by line breaks and indentation) can take one new inert slide again. The slide may be added inside the blank space between two tags; every other byte of the widget, including its script, stays as it was.

= 2.55.2 =
* Fix: editing the text of a page that mixes WordPress blocks with plain HTML through the whole-body editor can no longer add, remove or change a block marker. Only the text between blocks changes; an edit that would touch a marker is refused and nothing is written.

= 2.55.0 =
* Feature: a signed, read-only route shows one term of a public taxonomy (a WooCommerce product category, a post category or tag, a custom taxonomy): its name, slug, link, description and its text fields (the term's ACF fields and public term meta), each with a hash a later edit must quote, and an optional search for a phrase. Values that look like credentials are never returned and SEO plugin data is not listed.
* Feature: a signed route changes ONE text field of such a term: its description, one ACF text, text-area or visual-editor field, or one existing term meta value holding a single string. It writes only while the stored value is still the one the caller read (judged under the term's lock), only a value the field's own sanitizer would store unchanged, and reads it back to say whether it landed. The description is set on its one column without running other plugins' save filters, so no other part of the term changes. Names, slugs, parents, SEO data and new meta keys are never written.
* Feature: the guarded ACF field write also accepts a published entry of a public custom post type (for example a theme's service or gallery type), not only pages and posts. Attachments, menu items, templates and other non-public types are still refused.

= 2.54.0 =
* Feature: the guarded custom-field write can change one text, textarea or wysiwyg subfield inside an ACF group, addressed as group.subfield; the custom-field read lists such subfields. Other subfields of the group, and every other field type, are untouched.

= 2.53.0 =
* Fix: a guarded page-unit write to an Elementor page stores the planned data byte for byte even when the site's own save filters strip an html widget's style or script tags (the one row is set by a hook-free update and still verified by an exact read-back).

= 2.52.0 =
* Elementor empty-id repair: when a site's meta filters rewrite the stored Elementor data, the repaired bytes are set by a hook-free update of the one row and still verified by an exact read-back.

= 2.51.0 =
* Feature: a guarded page-unit update of an existing Elementor html widget may also swap one whole piece of its markup (for example one carousel slide, with its image and links) for one whole inert element, between two tags. The new element follows the same rules as an added one (plain text and basic tags, double-quoted attributes, no script, style, form, frame or event handler, links only relative or http, https, mailto or tel). The old piece may hold no script, style or comment, and nothing else in the widget may change.
= 2.50.0 =
* Fix: a guarded page-unit update of an Elementor section or widget no longer fails because it sends back, unchanged, parts the plugin would not accept on a new element (an html, template or third-party widget inside the section, a locked element, a dynamic-tag binding, custom CSS). Every part sent back exactly as stored is kept exactly as stored; only new or changed parts are checked, by the same rules as before. A changed html, template or third-party widget, and a new value for a setting bound to a dynamic tag (which Elementor would not show), are still refused.
= 2.49.0 =
* Elementor empty-id repair: a read-back mismatch now reports sizes, digests and the first differing offset (no content) so the cause can be found.

= 2.48.0 =
* Feature: a guarded page-unit update of an existing Elementor html widget may also add one whole inert element (for example one slide of a carousel) between two tags. The element may hold only plain text and basic tags (links, images, headings, lists) with double-quoted attributes, no script, style, form, frame or event handler, and links only relative or http, https, mailto or tel. Nothing else in the widget may change.
= 2.47.0 =
* Feature: a guarded page-unit update of an existing Elementor html widget may remove one whole piece of its markup (from < to >, occurring once), for example one slide of a carousel. Nothing can be added or changed, no other setting of the widget may change, and every other update of an html widget is still refused.
= 2.46.0 =
* Fix: hardening of the read-only operator session and the guarded menu edits, none of which any site uses yet. A session minted at the same moment as the cleanup of expired sessions is no longer lost, and the cleanup removes only expired sessions. A failed read of the operator user or of a page to land on is reported as unavailable instead of a missing user or an invalid landing. A write the operator session refuses now fails the same way on every WordPress version (old versions used to report success to code that tests for failure strictly, such as a draft being created when the editor opens a new post), and no longer fills the error log. Menu titles and descriptions with an unclosed or stray tag are refused before anything is written. Menu text an edit did not name is never stored in a filtered form, not even for an instant, and a plugin that saves another post while a menu item is being saved gets that post filtered as usual.
= 2.45.0 =
* Feature: a signed route changes the text of one ACF text, text-area or visual-editor field on a published page or post, only while the stored value is still the one the caller read, under the page's edit lock, and only to a value the field's own sanitizer would store unchanged. The value is read back after the write and the answer says whether it landed. Fields that look like credentials and every other field type are refused.
= 2.44.0 =
* Feature: a signed, read-only route lists where a page's text is stored outside its page builder: the page's ACF fields, its public custom fields, the active theme's customizer values and ACF options-page fields, each with where it lives and the key a later edit would name, and an optional search for a phrase. Values that look like credentials are never returned. Nothing is changed.
= 2.43.0 =
* Fix: guarded menu edits no longer reorder a live menu whose stored item order is not exactly 1 to N (a first item stored at 0, gaps left by a removal, values written by the older menu sync): an edit that does not move an item leaves every item where it was, and an add, reorder or restore writes the whole order. A page, category or archive link whose title is empty or the same as its target now reads back as verified. Submitted menu text can no longer carry script (it is cleaned the same way for a preview and a write), backslashes are kept, values WordPress would silently change (such as a numeric character reference) are refused, an add to a menu that already has 500 items is refused before anything is written and a menu over the limit can be cut back, a menu that has an item WordPress does not list (a link to a trashed page, a draft item) is refused before any write, a custom link can no longer be edited to an empty title or address, text an edit did not name is left exactly as stored even on a site whose save filters would strip it (icon markup in a menu title, for example), and a restore is refused on a menu that is already over the limit.
= 2.42.0 =
* Feature: a read-only operator session. MEGA can open a short window (5 to 15 minutes) in which its automated operator signs in as a dedicated `mega-operator` user to look at pages and the page editor. Nothing in it can change the site: the user's role has no capabilities of its own, and while the window is open it is given only the ability to read and open pages and posts in the editor, every database write from its requests is refused, and it cannot manage users, plugins, themes or settings. The sign-in is a single-use, 60 second token that MEGA redeems with a secret only it holds; the session lasts five minutes at a time, is tied to the browser's User-Agent, and ends when the window closes or expires. The operator cannot sign in with a password or an application password. Site administrators can switch it off at any time with a button on the MEGA settings page (or `MEGA_OPERATOR_DISABLED` in wp-config.php), which ends any open session at once. Not supported on multisite. Nothing happens on a site until MEGA opens a window.
= 2.41.1 =
* Fix: a sandbox copy or page duplicate of an Elementor page keeps the page's layout byte for byte even on a site that filters post meta as it is added (which could drop markup, such as a style block, from an HTML widget). When the stored copy differs from the source, the exact layout is written straight to the row.
= 2.41.0 =
* Feature: an Elementor page whose elements include an empty id (which Elementor and MEGA's validator refuse) can be repaired by one explicit, guarded operation: each empty id gets a new unique 7-character id while the stored layout still hashes to the value the caller read, under the page lock and after a pre-write revision. Only the empty id values change, byte for byte; Elementor's CSS for the page is rebuilt afterwards. Reading a page never changes an id.
= 2.40.0 =
* Feature: on a WooCommerce store, Mega can connect the store's order feed: a signed route creates (or repairs) one webhook named "MEGA SEO purchases" that sends order updates to the store's Mega webhook URL, owned by a store administrator, and sends WooCommerce's test ping. It only ever points at Mega's own WooCommerce webhook route, keeps the secret write-only, and a repeat call updates the same webhook instead of adding another.
= 2.39.0 =
* Fix: appending an item to an Elementor nested accordion also works when each item's answer sits in a boxed container inside the item container (item container, one boxed container, one text editor). The new item copies that layout with fresh ids; any other layout is still refused and no existing item changes.
= 2.38.0 =
* Feature: page units can add the core and Pro Elementor widgets customers ask for: image carousel, slides, gallery, basic gallery, video, tabs, nested tabs, nested accordion, social icons, Google Maps, call to action, price table, price list, testimonial carousel, flip box, icon, alert, progress bar, reviews, media carousel and blockquote. Every submitted setting is cleaned by its shape, nested repeater items included: links must be http(s), site-relative, tel:, mailto: or #fragment (checked as sent and as a browser decodes them) with no quotes, angle brackets, backslashes or whitespace, media ids must be attachments of the kind the setting shows (image, video, or an SVG file for an SVG icon), icons class names or SVG attachments, tag settings Elementor's own tag list, style values (every setting that is not a known text setting, by exact name) may not contain characters that leave a CSS declaration or leave a comment, string or bracket open, and text goes through the post sanitizer with script URLs and shortcodes refused. A nested widget holds exactly one container per item.
* Feature: an added or updated Elementor element may carry Elementor Pro custom CSS when every selector starts with `selector` and stays on the element: no other at-rules than @media, no sibling combinators or nesting, balanced brackets, no escapes outside strings, no script URLs, behaviours or expressions, and url() only on the site's own origin or a raster data image. Anything else is refused.
* Feature: `POST /mega/v1/editor/elementor-layout/{id}` is a guarded write. It requires `expected_content_revision`, takes the page lock, refuses a page that changed since it was read (`CONTENT_REVISION_MISMATCH`), decides the convert gate again under the lock, and reports the pre-write revision and the content revisions before and after.
* Feature: `POST /mega/v1/editor/revisions/{id}/restore` accepts an optional `expected_content_revision`; with it the restore runs under the page lock, takes a pre-restore revision so the restore can itself be undone, and reports the content revision after. Without it the restore is unchanged.
* Feature: sandbox copies of Elementor theme templates (headers, footers, single templates), without their display conditions, and a signed preview that renders a page with the copy in place of the live template for that one request.
* Feature: guarded menus. A menu snapshot with a revision, add, update, remove and reorder of items that refuse a menu changed since it was read, a guarded restore from a snapshot, and a signed preview that renders a page with a proposed menu for that one request. The existing menu sync keeps its shape and now waits its turn: it is refused (`MENU_WRITE_BUSY`) while a guarded menu edit holds the menu's lock. A plugin lock now records its holder's time limit, so a later caller can never cut it short.

= 2.37.0 =
* Feature: the editor adapter lists an Elementor page's copyable top-level sections (containers of headings, text editors and buttons) and appends one new last section, a copy of a named one with fresh ids and only its texts replaced. Existing sections are never changed.

= 2.36.0 =
* Feature: the editor adapter lists an Elementor Nested Accordion's items (id, title, body) and appends one new last item, a copy of the last item's layout with its own ids, title and text. Existing items are never changed.

= 2.35.0 =
* Feature: the editor adapter lists and edits Elementor Price Table copy (heading, sub-heading, period, button label, footer note, ribbon title and each feature row by its stable id). The price, currency and link are never listed.

= 2.34.0 =
* Fix: after an undo on a Bricks page, its generated CSS file again holds every element's styles. Bricks' own save, run by the revision restore, had marked them generated, so the rebuild wrote only the element defaults and the page lost its styling.
* Fix: a private test copy or draft duplicate of a Bricks or Beaver Builder page gets its own generated CSS, so it renders like the original.
* Fix: an edited Bricks element or Beaver Builder node keeps a setting sent back unchanged in any key order (such as a Beaver module's empty `connections`) instead of refusing it, and keeps the stored setting order.
* Improvement: the `BUILDER_DRAFT_PENDING` refusal reports why the Beaver draft differs (Beaver loaded or not, both layouts' size and hash, and the first differing nodes and fields), without page content.

= 2.33.0 =
* Feature: `POST /mega/v1/cache/flush` also clears the Kinsta server cache and CDN, the Sucuri firewall cache (when the site saved its Sucuri API key), Cache Enabler, Nginx Helper, Hummingbird, WP-Optimize, the Pantheon edge and Endurance Page Cache. Each uses only that host's or plugin's own purge call, runs only when present, and cannot stop the others if it fails.

= 2.32.0 =
* Feature: post and page updates write `canonical` ("" clears it) and `noindex` into whichever SEO plugin is active: Rank Math, Yoast, SEOPress and All in One SEO (its own table). Before this, `noindex` reached Rank Math only and `canonical` was ignored.
* Feature: SEOPress is detected as an SEO plugin; SEO title, meta description and focus keyword are written to and read from its own fields.
* Feature: `GET /mega/v1/posts/{id}` and `GET /mega/v1/pages/{id}` report `seo_canonical` and `seo_noindex` (null while the post follows the SEO plugin's default robots).

= 2.31.0 =
* Feature: the JSON-LD a schema write approves now renders exactly on the live page. `PUT /mega/v1/posts/{id}/schema` also stores the approved nodes (`_mega_schema_render`), and at render time they are merged into the SEO plugin's own graph: a native node with the same `@id` is replaced, else the first native node of the same `@type` takes the approved values (references to its old `@id` follow), else the node is added. Other native nodes are untouched and no node is added twice. Yoast and AIOSEO print the merged graph; on Rank Math, MEGA's rows leave Rank Math's graph and the approved nodes print in a separate script right after it, so Rank Math no longer rewrites their `@id`, turns numbers into strings or folds FAQPage into WebPage. When the SEO plugin prints no graph for the page, the approved nodes print on their own in `wp_head`.
* Feature: schema `GET` returns the stored nodes exactly (Yoast's selectors keep only `@type`), and `PUT` returns the post's `permalink` and `render_store`.
* Fix: Yoast and AIOSEO schema extras are no longer read on term archives, where the queried id is a term id.

= 2.30.1 =
* Fix: a Beaver Builder page whose draft matches its published layout the way Beaver compares them (after Beaver's own layout cleaning) is no longer refused as having unpublished changes. A real draft difference is still refused, and without Beaver loaded the check stays as strict as before.
* Fix: a private test copy of a Beaver Builder page now renders its layout in MEGA's signed preview. Beaver showed an empty page body because the copy is private in the database. Only the copy being previewed in that request is affected.
* A failed pre-write revision (`REVISION_FAILED`) now reports why: byte lengths and sha256 of the live and revision content, the database error class, the column charset and whether a db.php or object-cache drop-in is present. No content is included, and nothing else changes.

= 2.30.0 =
* Security: the daily file-integrity check also reports PHP files hidden in dot-folders under `wp-content` and in web-root folders that shadow a page slug, changes to the active theme's PHP files, administrator accounts (read straight from the database), a default user role that grants administrator-level access, and changes to code-injection settings and WPCode snippets.
* Security: administrator-level logins, plugin installs and activations, role changes, REST-created posts, default-role changes and file-editor use are reported to MEGA as signed events. The last seven days are kept in a bounded option and returned on the daily integrity check.
* Every new security feature loads only when it is used, so a fault in one disables that feature and never the site.

= 2.29.0 =
* Feature: page units on Bricks and Beaver Builder pages can be inserted, edited, moved and removed (`POST editor/blocks/{id}`), with undo. Before, they were read-only.
* The pre-write revision records every layout key of the builder that renders the page (Bricks: page content, header, footer, settings and editor mode; Beaver: data, draft, their settings, and the enabled flag), as its exact stored bytes or its absence. `editor/revisions/{id}/restore` puts each one back exactly and reads it back.
* A write takes only allowed elements (no code, html, form, query loop, template or embed elements; no custom CSS, attributes, conditions, interactions or dynamic data), sends new text through the WordPress sanitizer, and keeps Bricks children lists and Beaver positions consistent. Beaver's published layout and its matching draft are written together, and a page with unpublished Beaver edits is refused.
* After a write or an undo, only that page's builder CSS is rebuilt (the Bricks CSS file in file mode; Beaver's cached assets for that page). Nothing is flushed site-wide.
* `GET editor/blocks/{id}?layout=1` returns a Bricks or Beaver page's stored layout.

= 2.25.4 =
* Fix: a Divi 4 page saved inside one `wp:divi/placeholder` block (Divi 4 with the block editor on) is read as Divi 4 shortcodes, so its sections and modules are separate page units that can be edited, moved and added to. Before, the whole layout was one block. Only Divi 5 block names make a Divi page a block page.

= 2.25.3 =
* Feature: `DELETE /mega/v1/pages/{id}?scout_draft_only=1` also deletes an unpublished draft made by `POST /pages/{id}/duplicate`, under the same row lock and unpublished-only delete. The draft's stamp (`_mega_duplicated_from`) is signed for its own post id (`_mega_duplicate_sig`, HMAC under the site's auth salt), so a stamp copied to another post by a duplicator plugin or an export is refused, and both are removed the first time the page is published, so a rebuilt live page is never deletable this way.

= 2.25.2 =
* Fix: an Elementor element that stores an empty `__dynamic__` (or another refused setting left empty) can be updated by sending back what was read. The empty setting is dropped; a non-empty one is still refused.

= 2.25.1 =
* Fix: page units inside a builder module can be edited and moved: Divi accordion items, tabs, slides, counters, pricing tables, social links and map pins, and WPBakery tab, tour and accordion panels. Each item type now sits only in its own module, so an item can no longer be placed loose in a column.

= 2.25.0 =
* Feature: signed `POST /mega/v1/pages/{id}/duplicate` makes a permanent draft copy of a page on the site's own design: its page template, builder layout (Divi, Elementor), custom fields (ACF) and terms. SEO plugin settings (and MEGA's schema extras for them), the featured image and MEGA bookkeeping are not copied, so the copy never inherits the design page's title, description, canonical or JSON-LD. The copy is an ordinary draft: no expiry, no cleanup.
* Feature: `GET /mega/v1/pages/{id}` reports `design`, the page template, the builder and the page's custom fields (ACF field objects when ACF is active), so a page can be rebuilt on the same design.

= 2.24.0 =
* Feature: page units (`/mega/v1/editor/blocks/{post}`) now read and write WPBakery and Flatsome pages, with the same lock, has-it-changed check, pre-write revision and read-back as Gutenberg, Elementor and Divi. WPBakery raw HTML/JS modules and Flatsome `ux_html` are refused in submitted units.
* Feature: Bricks, Beaver Builder and Oxygen pages can be read as units (their own element ids, parents and text). Writing them is refused with `BUILDER_WRITE_UNSUPPORTED`: their layout lives in postmeta that the pre-write revision does not yet snapshot, so an edit could not be undone.

= 2.23.0 =
* Feature: signed `GET /mega/v1/editor/blocks/{post}` returns the page as a tree of addressable units (Gutenberg blocks, Elementor elements, Divi modules; a classic page is one unit) with stable ids, parents, text previews and the content revision a write must name. `GET /mega/v1/editor/blocks/{post}/{unit}` returns one unit's exact markup or element. Reading never changes the page.
* Feature: signed `POST /mega/v1/editor/blocks/{post}` inserts, replaces, moves or removes one unit. It runs under the page lock, is refused unless the page (and the unit) still match what was read, takes a restorable revision first, writes only the unit's bytes, sanitizes submitted text, refuses markup that would leave an element open, and reads the page back. Elementor CSS is rebuilt for that page only.
* Feature: on WordPress 6.9+, the same operations are registered as abilities (`mega/list-page-units`, `mega/get-page-unit`, `mega/edit-page-unit`) for logged-in editors.

= 2.22.0 =
* Feature: signed `GET|POST /mega/v1/editor/elementor-node/{post}/{node}` reads one Elementor element and removes exactly that element (a nested container, or one exact fragment of an HTML widget). A removal is refused unless the page revision and the element's bytes still match what the caller read; it runs under the page lock after a restorable pre-write revision, and the answer says whether a read-back of the stored layout equals the old layout minus that element. Nothing else on the page changes.

= 2.21.0 =
* Safety: `DELETE /mega/v1/pages/{id}?scout_draft_only=1` deletes only an unpublished, MEGA-managed feasibility scout draft. The check and the delete run in one database transaction holding the page's row lock, so a page published at the same moment is never deleted. Any other page, or a site whose posts table is not InnoDB, answers 409 and is left in place.

= 2.20.1 =
* Security: the file-integrity check now answers only signed `POST /mega/v1/integrity`. A host page cache could store the `GET` response and serve it to visitors who were not signed in.

= 2.20.0 =
* Feature: `GET /mega/v1/integrity` (signed, read-only) reports a file-integrity snapshot to MEGA: PHP files in the uploads folder, `.htaccess` / `.user.ini` directives that remap PHP handlers or set `auto_prepend_file`, mu-plugins, drop-ins such as `db.php` and `object-cache.php`, and WordPress core PHP files that differ from the official checksums. It reports paths, sizes, modified times and md5 hashes, never file contents. The scan runs on request under an 18 second time cap, resumes where a capped scan stopped (including inside a large uploads folder), ignores symbolic links, and takes a lock so only one scan runs at a time, and scans at most once every 10 minutes (requests in between get the last snapshot).
* Safety: set `define('MEGA_DISABLE_INTEGRITY', true);` in `wp-config.php` to turn the scan off. A scan that hits a fatal error switches itself off for 7 days.

= 2.19.1 =
* Fix: edits no longer clear every Elementor CSS file on the site; only the edited page's CSS is regenerated. Sandbox previews are never page-cached.

= 2.19.0 =
* Security: stronger request authentication. The plugin can now verify requests that carry a per-request signature over the method, address, query, body and a single-use nonce, so a captured request is of little use to anyone else. MEGA turns this on for a site; until then requests are authenticated with the older signature format as before. Once a site has accepted its first such request it stops accepting the older signature format.
* Security: MEGA's public key is checked against fingerprints built into the plugin before it is used to verify a signature (the older format too, when the default key address is in use), and the verified key is cached for an hour.
* Change: `GET /mega/v1/plugins` returns `change_log_secret` only to an older-format request on a site that has not switched.
* Feature: if MEGA cannot connect after a server or proxy change, an administrator can reset request authentication from Settings > MEGA, or with `wp mega auth-reset`. Nothing can reset it remotely.
* Change: replay records for the new signatures are kept in the options table and removed hourly.

= 2.17.2 =
* Packaging: the WordPress.org release no longer includes development and test files.

= 2.17.1 =
* Security: error responses no longer include the site identifier.

= 2.17.0 =
* Feature: `GET /mega/v1/editor/widgets/{id}` returns `content_revision` (and on each widget) for every builder: sha256 of the page content, plus the normalized Elementor data on Elementor pages.
* Feature: `POST /mega/v1/editor/widgets/{id}/{widget}` honours `expected_content_revision` on every builder (it was Divi only). A guarded write takes a per-page lock, re-checks the revision after the pre-write revision is saved, and refuses with 409 `CONTENT_REVISION_MISMATCH` (naming the observed revision) or `CONTENT_WRITE_BUSY` without writing. The answer carries `content_revision_before` and `content_revision_after`. Writes without the field behave as before; a present but empty or malformed field is refused with 400 `CONTENT_REVISION_REQUIRED`, never read as unguarded. The lock is an atomic database statement (not `add_option`), and a read that sees the page change while it lists the widgets answers 409 `CONTENT_CHANGED_DURING_READ`.
* Fix: reading widgets never fails where it worked before. An Elementor page whose content revision cannot be computed (data over 4 MB) still lists its widgets, with `content_revision` null and `content_revision_unavailable`; a guarded write to it is refused with 413 `CONTENT_TOO_LARGE` (a malformed tree is 409 `MALFORMED_TREE`).
* Fix: a page lock that cannot be taken because of a database error answers 503 `LOCK_UNAVAILABLE` instead of `CONTENT_WRITE_BUSY`; nothing is written.
* Change: the Divi editor lock now uses the same atomic lock, is released as soon as the write returns, and a corrupt lock value expires instead of blocking the page.

= 2.16.1 =
* Fix: `POST /mega/v1/cache/flush` now also purges NitroPack, WP Fastest Cache, SiteGround Optimizer, the Cloudflare plugin and Autoptimize. With `post_id`, NitroPack, WP Fastest Cache, SG Optimizer and Cloudflare purge only that post's URL; without it they purge the whole site, and Autoptimize runs only on that full flush. Before this, NitroPack kept serving the pre-edit page after a flush (it only invalidates a URL on save). Each plugin is called through its public API and skipped when it is not installed.

= 2.16.0 =
* Feature: `GET /mega/v1/plugins` also returns `inactive_plugins` (installed but not activated, same fields as `active_plugins`) so MEGA can scan dormant plugins. `active_plugins` is unchanged.
* Feature: the same response includes `app_passwords`, metadata only (name, created, last used, last IP, owning administrator) for every application password on the site, with the owning user's roles. The password itself is never sent. Omitted when WordPress cannot report them.

= 2.15.0 =
* Feature: signed phone-only replacement. `POST /mega/v1/phone-replace` takes an old and a new phone number (both must be one valid NANP number; nothing else can be searched for) and finds that number in every common format across theme options (Uncode/OptionTree, theme mods), text/HTML/block widgets, Slider Revolution sliders and slides (params, layers, settings), Uncode content blocks, menu links and labels, and post and page bodies including WPBakery shortcodes and `[vc_raw_html]` blocks. `mode: dry_run` lists every match per object with before/after snippets and a sha256 per object; `mode: apply` needs that `{key: sha256}` map, refuses the whole run (REVISION_MISMATCH, nothing written) if any object changed, and writes each object with a compare-and-set. Visible text keeps its own punctuation; tel:, callto: and sms: links (including URL-encoded WPBakery links) become E.164. Serialized and JSON values are decoded, walked and re-encoded, never text-replaced; serialized data that does not round-trip exactly or holds PHP objects is refused. Original bytes are stored per run and read back before the first write (JOURNAL_WRITE_FAILED and nothing written otherwise), and the journal is saved after every write; rollback reconciles each entry from its before/after hashes, so a landed write left `pending` by an interrupted request is still restored and content edited since is never overwritten. The post scan pages through every candidate and refuses (SCAN_TOO_LARGE) above 5,000 rather than returning a partial plan; `GET /mega/v1/phone-replace/runs/<id>` reads the audit record and `POST /mega/v1/phone-replace/runs/<id>/rollback` restores it (also hash-guarded). Posts get a pre-write revision and every write enqueues a change-log event.

= 2.14.5 =
* Add signed `/mega/v1/gravity-forms/*` routes to list Gravity Forms, list form notifications (non-secret fields only), and update notification `isActive`, `to`, `subject`, and `message`.

= 2.14.4 =
* Fix: editing one Gutenberg block or the classic editor body no longer re-filters the whole page. Iframes (maps, videos), scripts, forms, svg and responsive image attributes (srcset, sizes) in untouched content are preserved byte for byte, including when a classic edit changes several places at once. Only the changed values are sanitized.
* Fix: page content is written with an atomic compare-and-set of exact bytes, so WordPress entity conversion, tag balancing and other save filters cannot alter it. If another plugin rewrites the saved content, the previous content is restored and the error (WRITE_FAILED) reports whether that worked and carries the pre-write revision_id.
* Fix: Gutenberg widget edits could never find their target block (WIDGET_NOT_FOUND on every request) because of a reference bug; they now resolve it. Blocks that share a widget id (for example two covers with the same image) are refused with WIDGET_AMBIGUOUS and flagged in the widget list.
* Security: block and classic text is placed using WordPress's HTML API instead of pattern matching, so edits cannot land inside a script, comment or attribute. Markup the HTML API cannot place (doctype, CDATA, a legacy `<!--` inside a script, ambiguous comments or attribute quotes, svg/math contexts) is refused instead of approximated.
* Note: Gutenberg and classic widget edits need WordPress 6.5+ (the HTML API); older sites, or a core whose HTML API fails the plugin's self-test, get WP_VERSION_UNSUPPORTED. Edits that add or remove block delimiters are refused (INVALID_VALUE).
* Security: a page with a title, textarea, style, iframe, xmp, noembed or noframes element whose content contains markup (a `<`) cannot be text-edited (WIDGET_UNSUPPORTED, reason opaque_text_contains_markup), because a browser can re-parse that content differently from the sanitizer, for example inside a select.
* Security: a page whose content contains inline svg, MathML or noscript (found by a plain `<svg`, `<math` or `<noscript` anywhere, attributes, comments and scripts included) cannot be text-edited by a widget set: browsers parse that markup differently from the sanitizer, so the edit is refused (WIDGET_UNSUPPORTED, reason foreign_or_noscript_content). A text edit also cannot silently replace or delete an embed, script or style, and post-write hooks run in core's order with the post object; a hook that throws after a write is reported as WRITE_FAILED and logged as a change.

= 2.14.3 =
* Fix: a post is treated as Elementor only when Elementor would render it (builder edit mode with a stored tree). A stale Elementor tree left on a Divi, Gutenberg or classic page after "Back to WordPress Editor" no longer hijacks builder auto-detection, so edits reach the real content instead of silently converting the page to Elementor.
* Change: Elementor widget edits on a non-Elementor page, including an explicit builder=elementor, are refused with 409 BUILDER_MISMATCH, and widget edits never change a page's builder.
* Change: the Elementor layout endpoint refuses to switch a non-Elementor page unless the request sets "convert": true (blank pages need no flag); the response reports "converted".
* Fix: restoring an Elementor revision onto a page Elementor does not render is refused with 409 BUILDER_MISMATCH, and the layout endpoint no longer treats a blank page that has page-builder layout data (or an enabled builder flag) as blank; settings-only builder meta does not block it. An undo of a pre-2.14.2 revision on a page Elementor no longer renders restores the post content and reports elementor_snapshot_skipped.

= 2.14.2 =
* Fix: editor pre-write revisions and undo no longer strip responsive image attributes (srcset, sizes) from post content on any builder. Post content is kept byte-identical across revision and restore, and the call fails with RESTORE_VERIFICATION_FAILED or REVISION_FAILED if it cannot be.
* Note: revisions created before 2.14.2 may already have lost these attributes, and restoring them cannot bring them back.

= 2.14.1 =
* Fix: when WP Offload Media is installed, set per-object public-read ACL on uploaded originals and intermediate sizes so Mega-generated media under /wp-uploads/ is publicly readable. Does not make the bucket public.

= 2.14.0 =
* Add sandbox copies of posts and pages with an expiring anonymous preview link and automatic cleanup after two hours, and stop the cleanup schedule (after one last sweep of expired copies) on deactivation.
* Add guarded image sideload and image swap for Elementor images, Elementor backgrounds and block editor images on sandbox copies.

= 2.13.9 =
* Preserve literal backslashes in WordPress post and page content written through REST and editor adapters.
* Keep CMS diagnostics off published pages by using disposable draft canaries.

= 2.13.8 =
* Fix: preserve escaped JSON when saving Elementor rollback snapshots so guarded widget edits can verify and restore revisions containing quoted text.

= 2.13.7 =
* Fix: publish the builder-safe diagnostic detector repair as a new plugin version so WordPress.org serves the corrected package instead of retaining the prior 2.13.6 archive.

= 2.13.6 =
* Fix: Elementor widget writes no longer 500 on `REVISION_FAILED` when `_elementor_data` is stored as a decoded array or JSON that does not byte-match after the rollback snapshot write. Snapshot verify now canonicalizes through `normalize_elementor_snapshot` and compares sha256.

= 2.13.5 =
* Fix: Yoast no longer promotes `ProfilePage` to `_yoast_wpseo_schema_page_type` (the bare-`@type` slot). `ProfilePage` carries `mainEntity` (Person / Organization) and belongs with the other body-bearing types (`FAQPage`, `QAPage`) on the extras path (`_mega_yoast_schema_extra`) so that payload is preserved.

= 2.13.4 =
* Feature: signed `GET|PUT /mega/v1/menus` for listing WordPress navigation menus and adding or updating one parent link plus its requested children without removing unrelated items. Menu item writes now return a structured `WP_Error` when `wp_update_nav_menu_item()` fails instead of reporting a false success.

= 2.13.3 =
* Divi CAS writes now fire the shared post-write hook set after a successful conditional update.

= 2.13.2 =
* Divi text-module writes now reuse the shared `SHA2(post_content)` compare-and-set so a concurrent editor cannot overwrite a matching token.

= 2.13.1 =
* Compare-and-set content writes use a conditional `UPDATE ... WHERE SHA2(post_content, 256) = ...` so a concurrent editor cannot be overwritten between check and `wp_update_post`.

= 2.13.0 =
* Add compare-and-set on PUT /posts/{id} and PUT /pages/{id}: `expected_content_sha256` / `expected_modified_gmt` refuse with 409 when the stored body changed since it was read. GET post/page now includes `plugin_version`.

= 2.12.0 =
* Add `unreported_plugin_dirs` and `user_visibility` to GET /wp-json/mega/v1/plugins: a filesystem diff of WP_PLUGIN_DIR against `get_plugins()`, and a WP-vs-direct-DB user count, to surface self-hiding malware that filters `all_plugins`/`get_users`/`wp_count_users`.

= 2.11.2 =
* Fix: raise the Elementor schema-version guard to major version 4 so widget edits work on Elementor 4.x sites. The guard change shipped in the previous build without a version bump, so sites reporting 2.11.1 may or may not contain it; upgrading to 2.11.2 makes the fix identifiable.

= 2.11.1 =
* Fix: PUT /settings now reports `success: false` when the pushed site_key is unchanged (old-vs-new comparison), so the platform skips the page-cache purge on no-op syncs.
* Fix: PUT /settings now returns HTTP 500 when `update_option()` fails to persist a changed site_key, so the platform does not purge the cache for a key that was never stored.

= 2.11.0 =
* Add standalone CRO (Conversion Rate Optimization) script injection: a per-site script loaded from the MEGA CDN with experiment config baked in, separate from the main optimizer script.
* Add RSA-authenticated PUT /wp-json/mega/v1/settings endpoint for push-only siteKey configuration from the MEGA platform.
* Gate CRO script injection on site_key presence in plugin settings; without a site_key, no CRO script is loaded.

= 2.10.1 =
* Fix: do not treat native REST status-only publishing as a block-content flatten when WordPress includes the existing body in the prepared post.

= 2.10.0 =
* Add a closed-set, exact-URL and match-count-fenced intent for literal header/footer text-node corrections without arbitrary theme code edits.

= 2.9.2 =
* Maintenance release: add automated PHP 7.2, 7.4, and current-version compatibility checks before WordPress.org deployment.

= 2.9.1 =
* Fix a PHP 7 startup fatal caused by passing a cast expression to WordPress's by-reference revision API.

= 2.9.0 =
* Add bounded Elementor revision discovery, inspection, and hash-fenced recovery with an automatically captured rollback revision. Recovery supports structurally valid Elementor v4 snapshots without enabling untested v4 scalar widget edits.

= 2.8.1 =
* Reject malformed or non-array Rank Math schema metadata before any post mutation, preventing invalid schema strings from crashing Rank Math page rendering.

= 2.8.0 =
* Preserve authenticated MEGA task attribution in signed CMS change-log events.

= 2.7.2 =
* Fix nested Elementor widget writes so widgets returned by the editor listing can be updated reliably.

= 2.7.1 =
* Preserve reversible Elementor widget edits when WordPress revisions are disabled for the site or post type.

= 2.7.0 =
* Feature: the safe Elementor widget API now edits Icon Box text and links, Google Maps addresses, and individual Icon List item text and links using stable repeater item IDs. This lets agents correct contact/NAP details without relying on the visual editor or changing page structure.
* Fix: consecutive Elementor meta-only edits now receive distinct revision snapshots, and reverting a newly added link restores the prior absent URL without discarding other link settings.

= 2.6.1 =
* Fix: the post-update endpoint now writes ACF flexible-content fields (e.g. the "learn" CPT body) via update_field(), matching create. Previously ACF-body updates were silently dropped, leaving the customer-visible body stale.

= 2.6.0 =
* New: support publishing to WordPress custom post types (CPTs) via `post_type` field in create request.
* New: ACF flexible-content field support — `acf` payload in create request is written via ACF's `update_field()` API (not `update_post_meta`).
* Fix: slug dedup lookup (`get_posts`) now respects the `post_type` query parameter instead of hardcoding `post`, preventing duplicate CPT entries on retry.
* Fix: validate `post_type` exists before `wp_insert_post` — returns 400 for unknown types.

= 2.5.2 =
* Fix: block Rank Math array-valued meta keys (rank_math_robots, rank_math_advanced_robots) from the generic meta field — a scalar or pre-serialized string corrupts the value and can crash the live page.
* Fix: reject PHP-serialized strings in meta values to prevent double-serialization corruption.
* Fix: schema adapter now only deletes schema rows MEGA created (tracked by meta_id), preserving customer-managed Rank Math schema.
* New: `noindex` field now works for WordPress with Rank Math active — constructs the native rank_math_robots array server-side via read-modify-write, preserving existing directives (nofollow, noarchive, etc.).

= 2.5.1 =
* Fix: block→freeform flattens are now refused on EVERY save path, not just MEGA's signed endpoints. A headless-browser edit (wp.data.dispatch) that saves through core WordPress REST and drops a page's `<!-- wp:html -->` Custom HTML wrapper previously slipped past the guard; wpautop then corrupted inline `<script>`/`<style>` on the live page. Normal block edits, already-freeform pages, and revisions/autosaves are unaffected.

= 2.5.0 =
* Security: Add recursive validation for _elementor_data on all REST write requests — rejects document wrappers, non-list roots, and malformed Elementor trees that crash the page renderer.
* Security: Add rest_pre_dispatch guard that validates _elementor_data on native WordPress REST routes (/wp/v2/*), not just MEGA routes — prevents browser-initiated malformed writes.
* Feature: Add dedicated signed endpoint POST /mega/v1/editor/elementor-layout/{id} for safe full Elementor page layout creation/replacement with revision-backed rollback.
* Security: Validate Elementor snapshots before revision restore to prevent reintroducing malformed data.
* Security: Defense-in-depth validation in read_elementor_data(), update_post(), and update_page() meta loops.

= 2.4.2 =
* Fix: full-body writes that flatten a Gutenberg/Spectra (block) page — stripping every `<!-- wp:` block marker back to rendered HTML — are now refused, matching the existing page-builder flatten protection. Block-preserving edits are unaffected. (Spectra service pages were silently flattened.)
* Fix: Rank Math per-post schema (`rank_math_schema_*`) is now stored as a native array. Schema arriving as a JSON string is normalized before storage; a double-encoded JSON string previously crashed Rank Math's front-end schema generator (HTTP 500). Re-deploy affected page schema to heal pages stored under 2.4.1 or earlier.

= 2.4.1 =
* Fix: additive schema nodes (e.g. FAQPage) whose text contains a double-quote character now persist correctly. WordPress meta storage unslashes values, which previously corrupted the escaped quotes in the stored JSON-LD and made the node silently vanish on read-back and in the page <head>. The extras-schema writes (Yoast + All in One SEO) and the generic post-meta write path now wp_slash() their JSON before storage so it round-trips intact. Re-deploy affected page schema to heal pages stored under 2.4.0 or earlier.

= 2.4.0 =
* Fix: additive schema nodes that have no native host-plugin selector slot (notably FAQPage on Yoast and All in One SEO) are now reported in `written` — they were already persisted and rendered into the page <head> via the host plugin's schema filter, but the per-post schema API returned writtenCount:0, causing automated deploys to be treated as failures. `unmapped` is now an informational subset of `written` (filter-rendered, not shown in the host plugin's per-post UI).
* Fix: SEO plugin detection now falls back to runtime capability checks (loaded constants / classes) in addition to exact plugin-path matching, so an SEO plugin installed under a non-standard folder, network-activated, or via a Pro variant slug (notably All in One SEO Pro) is detected instead of returning "no supported SEO plugin".

= 2.3.0 =
* Feature: builder-page full-body write protection. The MEGA REST post/page update handlers now refuse `content_raw` writes that would flatten an existing page-builder page, with Flatsome/UX Builder detection added alongside the existing builder fingerprints.

= 2.2.0 =
* Feature: signed CMS change-log delivery for MEGA REST writes. The plugin now queues post/page, schema, editor widget, and intent mutations locally, retries delivery through WP-Cron, and signs each event with a generated webhook secret so MEGA can persist a durable CMS audit ledger.

= 2.1.1 =
* Fix: Prism reverse-proxy no longer intercepts requests from logged-in users. Prism serves content from a separate backend host that has no knowledge of the WordPress session, so proxying an authenticated member returned the backend's logged-out view (or a redirect to login/dashboard) and broke member-only pages (e.g. archive/library links bouncing to the dashboard). `prism_handle_request` now returns early for any logged-in request, so member and admin traffic is always rendered by WordPress itself. Also hardened route matching to skip malformed and empty/`/` path prefixes, which would otherwise match every request on the site.

= 2.1.0 =
* Feature: explicit per-page scope for Class A intents. Every static-output intent (e.g. `custom_json_ld`, `head_meta_tag`) now carries an explicit scope — either site-wide or a list of target page URLs — so schema/meta meant for one page no longer renders on every page. There is no implicit site-wide: megaseo-web requires the caller to declare scope. Scope is stored inside the existing intent `params` (no DB schema change), and the runtime matches the current request (by resolved post id, front page, or normalized path) before echoing. Intents published before this release have no stored scope and continue to render site-wide (backward compatible).
* Feature: `head_meta_tag` deduplication. When a known SEO plugin (Yoast, Rank Math) is active, a `description` intent now overrides that plugin's meta description via its filter instead of emitting a duplicate `<meta name="description">` tag. MEGA also dedups its own head metas so the same `name` is emitted at most once per request.
* Feature: `GET /mega/v1/intents/{id}` returns the full intent row (including stored `params` with scope and the pre-rendered `rendered_html`) for operational inspection. The list endpoint still omits those heavy fields.

= 2.0.1 =
* Hotfix: self-heal the `wp_mega_intents` table on plugin upgrade. v2.0.0 created the table only inside an activation hook and lazy REST write paths, so sites that auto-updated from v1.x to v2.0.0 without ever writing an intent ran the intent runtime against a missing table on every request, and `wpdb` echoed a public DB error before the doctype on home pages and inside REST/JSON responses. v2.0.1 adds (a) a `plugins_loaded` priority-5 `MegaIntentRunner::maybe_upgrade()` that runs `dbDelta` on a schema-version option mismatch, and (b) a `suppress_errors` guard around the runtime's intent-load `SELECT` so a missing table can never leak `wpdb::print_error()` output into the response. Pure hotfix — no API changes.

= 2.0.0 =
* Feature: intent runtime (safe-WP-code pipeline). New `POST/GET/DELETE /mega/v1/intents` and `POST /mega/v1/intents/kill-all` endpoints let the MEGA SEO platform push validated, hard-coded site behaviors into customer sites without executing any bot-supplied code. The bot picks an `intent_type` from a closed registry (e.g. `tracking_pixel`, `verification_meta`, `consent_script`, `heatmap_pixel`, `custom_json_ld`, `head_meta_tag`, `noindex_pages`, `outbound_link_attrs`, `disable_emojis`, `image_loading_attr`) and supplies structured `params`; megaseo-web validates the params and, for static-output intents, pre-renders the HTML payload server-side. The plugin echoes that pre-rendered HTML verbatim from a hooked closure or runs a hard-coded named handler for behavior intents. No `eval()`, `assert(string)`, or other dynamic-code primitive is ever applied to intent data. Intents live in a new `wp_mega_intents` table; the dispatcher in `runtime/intent-runner.php` wraps every handler callback in `try/catch(\Throwable)` plus a `register_shutdown_function` so a runtime fatal auto-deactivates the offending intent instead of bricking the site. A `?mega-safe-mode=1` query parameter (requires `manage_options`) is the customer's emergency disable hatch. The megaseo-web side (per-intent Zod validation, per-customer feature flag gating Class B intents, post-publish regression probe, Atlas task block reasons) is described in the platform's safe-WP-code plan doc.

= 1.7.0 =
* Feature: builder-aware widget edit surface. New `GET /mega/v1/editor/widgets/<id>`, `PATCH /mega/v1/editor/widgets/<id>/<widget_id>`, and `POST /mega/v1/editor/revisions/<id>/restore` endpoints expose a unified scalar-edit API across Elementor, Gutenberg, and Classic WP. The plugin auto-detects which page builder owns each post and dispatches to the matching `MegaEditorAdapter`. Every `PATCH` snapshots a WP revision first so the MEGA bot CLI can issue a single-call `undo` after a bad edit. Elementor support is pinned to major version <= 3 as a safety guard. Returns 404 with `code: editor_builder_unsupported` when an unknown builder is detected so callers can fall back gracefully.

= 1.6.2 =
* Feature: `?diagnostic=1` query param on `POST /mega/v1/pages/<id>`. When set, skips the `mega_managed=1` postmeta write so the MEGA SEO platform's CMS diagnostic worker can run a non-destructive page text-revert probe on a customer's most-recent published page without permanently tagging it as MEGA-owned. No effect on production write paths (which call without the flag); the platform's diagnostic Inngest worker passes `diagnostic=1` and the bot's normal publishing code does not.

= 1.6.1 =
* Removed self-update mechanism to comply with WordPress.org Plugin Directory guideline #8 (no loading executable code from external sources). Updates now flow exclusively through the WordPress.org plugin directory. No functional changes to /pages, /cache/flush, or any other endpoint shipped in 1.6.0.

= 1.6.0 =
* Feature: dedicated `/mega/v1/pages` REST surface — `GET|POST /mega/v1/pages` (list/create) and `GET|PUT|DELETE /mega/v1/pages/<id>` (read/update/delete) pinned to `post_type=page`. Mirrors the existing `/posts` handler shape (same response keys, same `meta` / `schema_jsonld` / `seo_title` / `meta_description` write semantics) so platform clients can use one parser for both. Returns 404 if the requested ID is not a page so callers can't accidentally mutate a post via the pages route. Unblocks the CMS diagnostic worker's page-revert probe and the page on-page-SEO bot path, both of which previously had to fall back to direct WP REST + Basic Auth.
* Feature: `POST /mega/v1/cache/flush` — purges Yoast indexables, Rank Math sitemap, WP Rocket, W3 Total Cache, LiteSpeed Cache, WP Super Cache, and WP core object cache. Each backend is detected at runtime and wrapped in try/catch so a mis-behaving cache plugin can't cascade-fail the whole flush. Optional `post_id` param scopes WP-core post-cache invalidation to a single post. Returns a `{cleared: {...}}` summary so callers can log which backends fired. Lets writer pipelines force-revalidate freshly-written content/meta without waiting on each cache backend's natural TTL.

= 1.5.2 =
* Maintenance release: republish of 1.5.1 to refresh the WordPress.org plugin directory metadata. No code change vs 1.5.1 — the schema-adapter fix below is the substantive change customers should care about. (1.5.1 was committed to SVN but the WordPress.org directory's metadata-refresh pipeline did not pick it up; 10up's deploy action refuses to re-push an already-tagged version, so a new tag is required to nudge the directory.)

= 1.5.1 =
* Fix: per-page JSON-LD schema for body-bearing `@type` values now persists with its full body on Yoast and AIOSEO sites.
  * Yoast: `FAQPage` and `QAPage` are no longer promoted to `_yoast_wpseo_schema_page_type` (the bare-`@type` slot). They fall through to the existing extras path (`_mega_yoast_schema_extra`) so `mainEntity` (questions/answers) is preserved.
  * AIOSEO: `FAQPage`, `Recipe`, `Product`, `ProductReview`, `Course`, `Dataset`, `Movie`, `Service`, `Car`, `SoftwareApplication`, `HowTo`, and `Person` are no longer promoted to `wp_aioseo_posts.schema.default.graphName`. They fall through to extras (`_mega_aioseo_schema_extra`) so `mainEntity` / `recipeIngredient` / `offers` / `jobTitle` / `worksFor` / etc. are preserved.
  * Both extras paths render verbatim via the existing `wpseo_schema_graph` / `aioseo_schema_output` filters — the same path `Organization` and `BreadcrumbList` have used since 1.3.0.
  * Previously these types were reduced to a bare `{"@type":"…"}` on storage and the host SEO plugin rendered an empty stub node.
  * No-op for Rank Math sites (its adapter already wrote full bodies per `@type`).
  * No-op for `Article` / `WebPage` / `BlogPosting` / `NewsArticle` on either adapter — those keep using native promotion because the host plugin reconstructs their body from the WP post record.

= 1.4.0 =
* Feature: AIOSEO (All in One SEO) schema adapter — `GET|PUT|DELETE /mega/v1/posts/<id>/schema` now works on sites running AIOSEO Lite or Pro, in addition to Rank Math and Yoast.
  * The first JSON-LD node whose `@type` matches an AIOSEO-known graph (Article, BlogPosting, NewsArticle, WebPage, FAQPage, Product, Recipe, Service, Person, Course, Dataset, Movie, ProductReview, Car, SoftwareApplication) is promoted to `wp_aioseo_posts.schema.default.graphName` and shows up in AIOSEO's post-editor schema metabox.
  * Remaining nodes are stashed in `_mega_aioseo_schema_extra` and merged into AIOSEO's rendered `@graph` at request time via the official `aioseo_schema_output` filter — same extension pattern Yoast uses.
  * A sentinel postmeta key (`_mega_aioseo_default_owner`) tracks which `default.graphName` slot we own so we never overwrite a manual selection a customer made in the AIOSEO metabox.
  * AIOSEO's user-authored `graphs[]` and `customGraphs[]` arrays are read but never written by this plugin — they remain entirely under customer control.
* Feature: AIOSEO SEO title and meta description support — `seo_title` and `meta_description` on `GET|POST|PUT /mega/v1/posts[/<id>]` now read from and write to the `wp_aioseo_posts.title` / `wp_aioseo_posts.description` columns when AIOSEO is the active SEO plugin.
* Updated: `mega_schema_no_seo_plugin` error message now mentions AIOSEO alongside Rank Math and Yoast.

= 1.3.0 =
* Feature: per-post JSON-LD schema via host SEO plugin (Rank Math / Yoast).
  * New endpoints `GET|PUT|DELETE /mega/v1/posts/<id>/schema` and inline `schema_jsonld` field on `POST|PUT /mega/v1/posts[/<id>]`. REPLACE-ALL semantics — read before writing to preserve.
  * Rank Math adapter writes one `rank_math_schema_<Type>` post meta row per JSON-LD node; Rank Math renders them as part of its native schema graph and they appear in the Rank Math editor UI.
  * Yoast adapter maps page-type / article-type nodes to `_yoast_wpseo_schema_page_type` / `_yoast_wpseo_schema_article_type` (visible in the Yoast UI). Nodes that don't fit those selectors are stashed in `_mega_yoast_schema_extra` and rendered into Yoast's runtime graph via the `wpseo_schema_graph` filter.
  * `GET /mega/v1/posts` accepts a new `post_type` query parameter (single, comma-separated list, or `any`) and a free-text `search` parameter so the platform can enumerate pages and custom post types, not just blog posts.
* Removed: the `_mega_jsonld_schema` self-rendered `wp_head` injection shipped in 1.2.2. Replaced by the adapter above so the host SEO plugin owns rendering — avoids duplicate `<script type="application/ld+json">` tags and makes schema visible in Yoast / Rank Math UIs. The `_mega_jsonld_schema` post_meta key is no longer read; legacy values can be removed with `DELETE /mega/v1/posts/<id>/schema` after migrating to the new path.

= 1.2.2 =
* Feature: render bot-managed JSON-LD schema in `<head>` on singular views. Reads the `_mega_jsonld_schema` post_meta key (written through the existing `meta:{}` field on `POST /mega/v1/posts/<id>`) and emits it as `<script type="application/ld+json" data-mega-managed="1">` at `wp_head` priority 99. Lets the MEGA platform deploy LocalBusiness / RealEstateAgent / FAQ / Service schema on sites that don't have Yoast or Rank Math controlling the relevant schema type. A site-wide schema slot is planned for a follow-up release.

= 1.2.1 =
* Compatibility: defer Prism's `template_redirect` hook to priority 20 so plugins like WP Fusion (default priority 10) can run their auth and membership gates first. Prevents authenticated users from being redirected away from archive pages on sites that gate content via `template_redirect`.

= 1.1.1 =
* Maintenance release

= 1.1.0 =
* New Feature: Prism - Reverse proxy functionality
* Serve external content through your WordPress site with configurable routes
* Support for custom headers per route
* Intelligent caching with configurable TTL
* Admin UI for managing proxy routes

= 1.0.8 =
* Bug fixes

= 1.0.7 =
* Fixed WordPress coding standards compliance
* Added proper cache headers to REST API responses
* Tweaks and improvements

= 1.0.0 =
* Initial release
* Secure authentication system
* Full REST API for content management
* SEO plugin integration (Yoast & Rank Math)
* Embed preservation support
* Webhook support for cache invalidation
* MEGA optimizer script injection

== Upgrade Notice ==
= 1.6.2 =
Adds `?diagnostic=1` opt-in flag on `POST /mega/v1/pages/<id>` for non-destructive page probes. Purely additive — no change to existing write semantics. Production write paths are unaffected.

= 1.6.1 =
Removes self-update mechanism for WordPress.org compliance. No functional or endpoint changes.

= 1.6.0 =
Adds dedicated `/pages` REST endpoints (list/get/create/update/delete) and a `/cache/flush` endpoint that purges Yoast, Rank Math, WP Rocket, W3TC, LiteSpeed, WP Super Cache, and WP core object cache. Purely additive — no behavior change to existing routes. Auto-installs via the plugin's self-update mechanism.

= 1.5.2 =
Republish of 1.5.1 with no code changes. If you are on 1.5.1 already, this update is purely cosmetic — it exists so the WordPress.org plugin directory listing reflects the 1.5.1 schema-adapter fix described below.

= 1.5.1 =
Fixes per-page JSON-LD schema for body-bearing `@type` values on Yoast (FAQPage, QAPage) and AIOSEO (FAQPage, Recipe, Product, Person, HowTo, …) sites — their full body (`mainEntity`, `recipeIngredient`, `offers`, `jobTitle`, …) is now preserved end-to-end instead of being reduced to an empty stub. No behavior change for `Article` / `WebPage` / `BlogPosting` / `NewsArticle` on either adapter, for Rank Math sites, or for sites with no SEO plugin. No customer action required — the MEGA platform's self-update mechanism (introduced in 1.5.0) rolls this version to managed sites automatically.

= 1.4.0 =
Adds full AIOSEO (All in One SEO) support: per-page JSON-LD schema, SEO titles, and meta descriptions now route through AIOSEO's native storage on sites that use it. Purely additive — no behavior change for sites running Rank Math, Yoast, or no SEO plugin.

= 1.3.0 =
**Behavior change** for sites running 1.2.2: the legacy `_mega_jsonld_schema` post meta + `wp_head` injection is **removed** in 1.3.0. Per-page JSON-LD schema now routes through Rank Math or Yoast SEO via a new adapter (visible in their native editor UIs, no duplicate `<script type="application/ld+json">` tags). Any schema previously stored only in `_mega_jsonld_schema` will stop rendering after upgrade until it is rewritten through the new `GET|PUT|DELETE /mega/v1/posts/<id>/schema` endpoint, which the MEGA platform handles automatically for managed sites on the next bot pass.
