Documentation menu Creating Your First Rule

Rules

Creating Your First Rule

Create your first ContentLatch rule in the Rule Builder—set WHEN conditions, THEN validations, Blocking or Warning severity, and test it in the editor.

The rule model

Every ContentLatch rule targets a post type and uses the same structure:

  • WHEN — optional conditions that decide when the rule applies
  • THEN — optional validations that decide what must be true
  • Severity — Blocking or Warning

A rule needs at least a WHEN condition or a THEN validation. Multiple WHEN conditions use AND logic in V1. Leave WHEN empty to apply the rule to every post of the selected type.

Example 1: Condition-only rule

This is a user-defined governance rule—not a built-in dictionary of banned words.

Restricted terminology

Applies to: Posts

Blocking
WHEN
Content contains "healthy"
THEN
No validation needed
Rule preview

When Content contains "healthy", this rule blocks publishing.

What this means

  1. Open ContentLatch → Rules → Add New Rule.
  2. Name the rule and set Applies to (for example, Posts).
  3. Under WHEN, choose the Content field, operator contains, and value healthy.
  4. Leave THEN without a validation (condition-only).
  5. Set severity to Blocking.
  6. Save the rule and keep it Active.

When Content contains the configured term, the rule itself becomes the finding. With Blocking severity, publishing (and updates to published/private content on supported paths) is prevented until the content no longer matches.

contains is a case-insensitive literal substring match. It is not regex, wildcard, fuzzy, or AI matching. Empty search values are invalid.

Condition-only rule: WHEN Content contains “healthy”, Blocking — matching the condition is the finding.

Example 2: WHEN + THEN validation

Require body when titled

Applies to: Posts

Blocking
WHEN
Title is not empty
THEN
Content is required
Rule preview

When Title is not empty, Content is required.

Build it

  1. Applies to — choose the post type.
  2. WHEN — Title · is not empty.
  3. THEN — Content · Required.
  4. Severity — Blocking or Warning.
  5. Save.

ContentLatch evaluates the THEN requirement only after the WHEN conditions are satisfied.

Conditional validation: WHEN Title is not empty, THEN Content is required.

Testing a rule

  1. Edit a post of the target type in Classic Editor or the block editor.
  2. Enter content that should fail the rule.
  3. Attempt to publish (or update published/private content).
  4. Confirm the outcome: in the block editor, Core Blocking surfaces through the editor/REST presentation with ContentLatch · Blocking; Classic Core Blocking interrupts the save before persistence (it does not show an inline Classic Blocking notice); Warning findings can appear in-editor without blocking the save; ACF Blocking can use ACF’s inline validation.

Drafts, autosaves, and revisions are not blocked in V1. You can still save work in progress even when a Blocking rule would fail on publish.

Next steps