=== ContentLatch ===
Contributors: elijahwill
Tags: acf, validation, content audit, quality control, content governance
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Define the content rules your site requires, then automatically validate content against those rules before publication.

== Description ==

ContentLatch is a WordPress content governance and validation plugin. Site administrators define rules for WordPress Core and Advanced Custom Fields (ACF) fields, then ContentLatch evaluates content against those rules when editors save or publish.

Define the content rules your site requires, then automatically validate content against those rules before publication.

ContentLatch is not an AI tool, SEO scanner, malware scanner, spell checker, or content generator. It enforces the rules you configure.

= How it works =

1. Create a rule for a post type.
2. Optionally choose when the rule applies (a WHEN condition).
3. Optionally choose what must be true (a THEN validation).
4. Choose severity: Blocking or Warning.
5. ContentLatch evaluates content during editing and save.
6. Blocking findings prevent publishing or updating published/private content.
7. Warnings alert the editor but do not block publication.
8. Run an Audit to evaluate existing published and private content against your active rules.

A rule needs at least a WHEN condition or a THEN validation. You may create a condition-only rule (WHEN without THEN). When that condition matches, the rule itself becomes the finding. That is useful for governance rules such as prohibited terminology.

= WordPress Core fields =

* Title
* Content
* Excerpt
* Slug
* Featured Image
* Author

= ACF field types =

Supported scalar types:

* Text, Textarea, Number, Range
* Email, URL, Password
* WYSIWYG
* Select (single), Radio, Button Group, True/False
* Date Picker, Date Time Picker
* Color Picker

Supported structures:

* Group → scalar
* Repeater → scalar
* Nested Repeater → scalar (up to two Repeater levels)
* Flexible Content → scalar, and Flexible Content → Group → scalar
* Clone → scalar, and Clone → Group → scalar (seamless or group display)
* Clone inside Repeater or Flexible Content
* Repeater → Clone → scalar

Not supported in V1 (examples): Relationship, Post Object, Page Link, Taxonomy, User, Checkbox, Gallery, Image, File, Link, Google Map, oEmbed, multi-select Select, deeper than two Repeater levels, Repeater → Group, Repeater inside Flexible Content, nested Flexible Content, and Clone → Clone / Repeater / Flexible Content.

ACF field validation requires Advanced Custom Fields 6.0 or higher (Free or Pro). Repeater, Flexible Content, and Clone require ACF Pro. WordPress Core field validation works without ACF.

= Conditions (WHEN) =

* Equals / Not equals
* Empty / Not empty
* Contains / Does not contain
* Greater than / Greater than or equal
* Less than / Less than or equal

Contains and does not contain are WHEN conditions only. They are not THEN validators.

Numeric comparisons apply to number and range fields. Date fields support equals, not equals, empty, and not empty.

= Validations (THEN) =

* Required
* Minimum length
* Maximum length
* Allowed values

= Severity =

* **Blocking** — Prevents publishing or updating content when the rule fails. In V1, blocking applies to publish and private update flows. Drafts, autosaves, and revisions are not blocked.
* **Warning** — Shows an editor notice but does not prevent publishing.

= Editors and save paths =

* Classic Editor
* Block editor (Gutenberg)
* ACF save validation
* WordPress Core field validation

Blocking and warning behavior is available on these supported paths. ContentLatch does not add WooCommerce-specific rules, GraphQL support, or custom Gutenberg block-level rule building beyond the Core and ACF fields listed above.

= Content Audit =

Audit evaluates existing published and private content against your active rules.

* Results summarize content that passed, needs attention, or needs review.
* Findings identify the affected field and rule.
* Repeater findings retain row context.
* Completed audit runs can be reviewed historically.
* Large sites may take longer because audits process content in batches.

Audit reports issues. It does not change your content.

= Permissions =

Managing rules and running audits requires the ContentLatch management capability (granted to administrators on activation). Editors are validated when they save content they can edit. Blocking rules prevent non-compliant content from being published or updated on the supported save paths.

= Privacy =

ContentLatch does not send plugin data to external services. Rules, audit results, and validation run on your WordPress site.

= Uninstall / data removal =

Deleting (uninstalling) ContentLatch removes its stored plugin data from the site, including:

* All ContentLatch rules
* Audit runs and findings (custom database tables)
* The ContentLatch management capability

Deactivating the plugin without deleting it keeps this data.

== Installation ==

1. In WordPress Admin, go to **Plugins → Add New**.
2. Search for **ContentLatch**, then install and activate it.
3. For ACF field validation, install and activate Advanced Custom Fields 6.0 or higher (Free or Pro, as needed for your field types). WordPress Core field validation works without ACF.
4. Alternatively, install from a downloaded package: upload the plugin ZIP via **Plugins → Add New → Upload Plugin**, or place the plugin folder at `/wp-content/plugins/contentlatch`, then activate ContentLatch.
5. Open **ContentLatch** in the admin menu to create rules and run audits.

== Frequently Asked Questions ==

= Does ContentLatch require Advanced Custom Fields (ACF)? =

No. ContentLatch works with WordPress Core fields without ACF installed. To validate ACF fields, Advanced Custom Fields 6.0 or higher (Free or Pro) is required. ACF Pro is required for Repeater, Flexible Content, and Clone fields.

= Can I create a rule with only a WHEN condition? =

Yes. When the condition matches, the rule becomes the finding. Use Blocking or Warning severity as needed.

= Does Audit change my content? =

No. Audit only reports findings against your active rules.

= What happens when I delete the plugin? =

Uninstalling removes ContentLatch rules, audit data, and the ContentLatch management capability. Deactivation alone does not remove that data.

= Does ContentLatch work with the block editor? =

Yes. ContentLatch validates supported Core and ACF fields in both the Classic Editor and the block editor on the supported save paths.

== Screenshots ==

1. Create custom content rules with conditional logic, field validation, and blocking or warning severity.
2. Manage governance rules across post types, with severity controls, activation status, and audit findings.
3. Prevent noncompliant content updates and highlight missing required fields directly in the WordPress block editor.
4. Audit existing content against active rules, review blocking issues and warnings, and navigate to affected content.

== Changelog ==

= 1.0.1 =
* Fix misleading admin notice that implied Advanced Custom Fields was required for all ContentLatch features. ACF remains optional for WordPress Core field validation; a warning is shown only when an installed ACF version is older than 6.0.

= 1.0.0 =
* Initial public release.
* Rule-based content validation for WordPress Core and ACF fields.
* WHEN conditions and THEN validations, including condition-only rules.
* Blocking and warning severity.
* Classic Editor and block editor validation.
* ACF Group, Repeater (including two-level nesting), Flexible Content, and Clone support as documented above.
* Site-wide content audits with historical review and Repeater row context.
* Uninstall removes ContentLatch rules, audit data, and capability.
