Documentation menu Creating Your First Rule

Rules

Creating Your First Rule

Build a WHEN / THEN rule, choose severity, and see how ContentGuard evaluates content.

The rule model

Every ContentGuard 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
  • SeverityBlocking 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 ContentGuard → 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 — no THEN validation required.

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.

ContentGuard 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 editor shows ContentGuard · Blocking or ContentGuard · Warning with the field finding.

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