== Changelog ==

= 2.0.2 [2026-07-18] =

**Fixed**

* Bulk action "Enable Robots Override" no longer creates duplicate `postmeta` rows. The previous implementation used `INSERT ... ON DUPLICATE KEY UPDATE`, but WordPress's `postmeta` table has no unique key on `(post_id, meta_key)`, so the `ON DUPLICATE KEY UPDATE` branch never fired and every bulk run on a post that already had the meta inserted a duplicate row. The bulk handler now uses `update_post_meta()` and `delete_post_meta()` exclusively.
* Bulk action "Disable Robots Override" now removes the override meta entirely (previously set its value to `0`, leaving a redundant row).

**Changed**

* Removed three dead contexts (`feed`, `comment_feed`, `robots`) that were registered, migrated, and cleaned up but never evaluated at runtime and never exposed in the admin UI. The plugin now consistently registers and evaluates 22 page contexts (down from a nominal 25). Existing orphan options from earlier installs are cleaned by the uninstall routine's wildcard delete.
* Extracted `noindex_seo_get_contexts()` as the single source of truth for the context list shared by settings registration, v2 migration, form processing. `uninstall.php` retains its own copy (technical constraint: the main plugin file is not loaded during uninstall) with a sync warning comment.
* Corrected `phpcs.xml` `minimum_supported_wp_version` from `6.6` to `5.7` to match the plugin header. This setting was stale from before the 2.0.1 minimum-WP correction.
* Updated `readme.txt` description counts from 25 to 22 page contexts.
* **Bulk action performance characteristic changed**: the rewrite from a single batched SQL statement to per-post `update_post_meta()` / `delete_post_meta()` calls trades O(1) queries for O(N) queries on bulk selections, in exchange for correctness (no more duplicate rows) and proper WP meta-cache invalidation. Typical admin bulk selections (≤200 posts) are unaffected; very large selections (thousands of posts) may take noticeably longer.

**Deprecated**

* `noindex_seo_clear_transient()`: was hooked to `update_option_noindexseo`, a hook that never fires because `noindexseo` is the Settings API group name, not an option name. The function now emits a deprecation notice via `_deprecated_function()` and continues to clear the `noindex_seo_options` transient if called directly. The transient is cleared correctly inside `noindex_seo_process_form()` after every successful save. The function will be removed in a future release.

**Code Quality**

* `bin/preflight.sh`: hardened temp-file handling (mktemp moved to script top, `trap … EXIT` cleanup, no more predictable `/tmp/composer-audit.*` paths that were vulnerable to symlink overwrite on shared hosting); fixed `2>/null` typo; added rsync / `.distignore` / build-tree-non-empty guards so the forbidden-artefact scan cannot pass vacuously; replaced npm-audit subshell with `pushd`/`popd` so gate counters are not lost.
* Added `bin/preflight.sh`: automated pre-deploy verification covering PHPCS, PHPStan level 9, PHPCompatibility, PHPUnit, dependency audit, and candidate-ZIP artefact inspection. Prints a PASS/FAIL report per section and exits non-zero on any failure.
* Added `.claude/settings.json` deny rules for `deploy.sh`, `git push`, `git tag`, and `git merge`, enforcing the agent operating boundaries mandated by AGENTS.md mechanically rather than only in prose.

**Compatibility**

* WordPress: 5.7 - 7.1
* PHP: 7.2 - 8.5

**Tests**

* PHP Coding Standards: 3.13.5
* WordPress Coding Standards: 3.3.0
* PHPStan: 2.1.55
* PHPUnit: 9.6.34

= 2.0.1 [2026-05-25] =

**Added**

* New option "Delete all plugin data on uninstall" (Settings → noindex SEO → General Configuration). By default, all data is preserved when the plugin is uninstalled. Enable this option to remove all settings and per-post directives on uninstall.

**Changed**

* Lowered minimum WordPress requirement from 6.6 to 5.7, matching the actual oldest API used (`wp_robots` filter, introduced in WP 5.7). Verified with `johnbillion/wp-compat`.
* Custom post types registered by plugins or themes on the `init` hook now correctly receive the Robots column, bulk actions, and list filter in granular control mode. Previously only built-in post types (`post`, `page`, `attachment`) were supported.

**Code Quality**

* Added `NOINDEX_SEO_VERSION` constant; all enqueued assets now use it for cache-busting.
* PHP type safety: replaced `(string)` casts on `mixed` values from `get_option()`, `get_post_meta()`, and `$_POST`/`$_GET`/`$_REQUEST` superglobals with proper `is_string()`/`is_scalar()` narrowing guards. Passes PHPStan level 9 on PHP 8.5 with zero errors.
* Extracted `noindex_seo_save_directives_from_post()` helper; meta box save and Quick Edit save now share a single implementation.
* Improved `noindex_seo_contexts` filter documentation: documents the `str_replace`-based directive key derivation and the `noindex_seo_{context}` key format requirement.
* Removed dead code: `isset($field['conditional'])` block (key never existed in field shape), redundant `isset($field['suggestion'])` guard, redundant `isset($section_icons[$section_id])` guard, and a provably non-empty `$meta_query` check.
* Removed dead hook registration for `update_option_noindexseo` (Settings API group name, not an option name; hook never fired).

**Compatibility**

* WordPress: 5.7 - 7.1
* PHP: 7.2 - 8.5

**Tests**

* PHP Coding Standards: 3.13.5
* WordPress Coding Standards: 3.3.0
* PHPStan: 2.1.55
* PHPUnit: 9.6.34

= 2.0.0 [2026-01-20] =

**New Features**

* 5 independent robots directives: noindex, nofollow, noarchive, nosnippet, noimageindex
* Each directive can be enabled independently for any page context (125 total options)
* HTTP Headers support: Choose between HTML meta tags, HTTP headers, or both
* Granular per-post/page control (optional):
  - Override global settings for individual posts/pages
  - Meta boxes for Classic Editor
  - Native Gutenberg sidebar panel for Block Editor
  - Quick Edit support for fast inline editing
  - Bulk actions to enable/disable overrides
  - Custom "Robots" column in post lists
  - Filter posts by override status
* Modern checkbox-based interface with emoji icons and tooltips

**Security & Code Quality**

* Modernized code with PHP 7.2+ strict types and type declarations

**Compatibility & Migration**

* WordPress: 6.6 - 6.9
* PHP: 7.2 - 8.5
* Automatic migration from v1.x (your existing settings are preserved)
* No manual configuration needed - just update and go
* Fully backward compatible

= 1.2.0 [2025-04-08] =

**Changes**

* Improved functions documentation.

**Fixes**

* The way the options are saved.

**Compatibility**

* WordPress: 4.1 - 6.8
* PHP: 5.6 - 8.4

**Tests**

* PHP Coding Standards: 3.12.1
* WordPress Coding Standards: 3.1.0
* Plugin Check (PCP): 1.4.0

= 1.1.1 [2024-11-04] =

**Added**

* Configuration option to dismiss other SEO plugin incompatibilities.

**Compatibility**

* WordPress: 4.1 - 6.7
* PHP: 5.6 - 8.4

= 1.1.0 [2024-11-02] =

**Added**

* Detects other WordPress SEO plugins, and creates a notice about it, to avoid conflicts.
* Has filters, so other plugins can hack.

**Changed**

* Uses native wp_robots functions (since WP 5.7+)
* Big refactory.
* Less size, improved code quality.

**Compatibility**

* WordPress: 4.1 - 6.7
* PHP: 5.6 - 8.4

**Tests**

* PHP Coding Standards: 3.10.3
* WordPress Coding Standards: 3.1.0
* Plugin Check (PCP): 1.1.0

= 1.0.12 =

* Compatibility: WordPress 4.1 - WordPress 6.4.
* Compatibility: PHP 5.6 - PHP 8.3.
* Compatibility: WordPress Coding Standards 3.0.1.

= 1.0.11 =

* Fix showing all the text.

= 1.0.10 =

* WordPress Coding Standards 3.0.0 compatible.

* Compatibility: PHP 5.6 - PHP 8.3.

= 1.0.9 =

* Improved functions checking.

* Compatibility: WordPress 5.2 - WordPress 6.3.
* Compatibility: PHP 7.0 - PHP 8.3.

= 1.0.8 =

* Compatibility: WordPress 5.2 - WordPress 6.2
* Compatibility: PHP 7.2 - PHP 8.1

= 1.0.7 =

* Minor refactoring

* Compatibility: WordPress 4.9 - WordPress 6.1
* Compatibility: PHP 5.6.20 - PHP 8.1

= 1.0.6 =

* Compatibility: WordPress 4.9 - WordPress 6.0
* Compatibility: PHP 5.6.20 - PHP 8.1

= 1.0.5 =

* Compatibility: WordPress 4.9 - WordPress 5.9
* Compatibility: PHP 5.6.20 - PHP 8.1

= 1.0.4 =

* Compatibility: WordPress 5.8

= 1.0.3 =

* Compatibility: WordPress 5.7

= 1.0.2 =

* Compatibility: WordPress 5.6
* Compatibility: PHP 8.0

= 1.0.1 =

* Compatibility: WordPress 5.5

= 1.0.0 =

* Compatibility: WordPress 5.4

= 0.1 =

* First version.
