If you can't explain the 2am failure, don't ship the AI feature
At 2:14 on a Sunday morning, a nightly job at a Fortune 500 apparel brand started rewriting short descriptions for about 340 SKUs. The job read ACF attributes, sent them to Claude, and wrote the response straight into the product's post_content. One jacket had a null value in its fabric field. The model did what language models do with a gap: it filled it in. The live copy said the shell was "fully waterproof to 10,000mm with recycled ripstop." None of that was true.
Nobody noticed for six hours. The page cache served the bad copy to every visitor until the morning merchandising team saw it in a screenshot from a customer. Rollback took two hours because we had no revision snapshot and the object cache keys didn't include a content hash, so purging one URL left stale fragments everywhere else.
That incident is why I now think most AI features in WordPress are liabilities dressed as features. The feature demo always works. The question that decides whether it survives is simpler: can you finish this sentence before anyone writes a line of code?
"When the model is wrong, ______ reaches ______ within ______, and ______ finds out by ______."
If you can't fill in the blanks, you don't have a feature yet. You have a bet that nothing bad will happen at 2am.
Why the usual safeguards don't cover this
Most teams answer the risk with "we'll add human review." That's necessary and insufficient. Review works when someone is looking at the output at the moment it matters. It fails for scheduled jobs, webhook-triggered rewrites, bulk backfills, and anything that touches a few thousand records on a Sunday. Review also decays. Within a month people approve the batch summary without opening a single product.
I also disagree with the common advice to "just lower the temperature." Temperature changes the variance of the output. It does nothing about the fact that a null field gives the model an invitation. The fix is upstream of the model: control what it's allowed to see, what it's allowed to write, and where the write lands.
The checklist we run before any LLM touches a store
1. Write the sentence, then pick the blast radius
Every AI write path should land in a draft or a staging meta key first. Publishing is a separate, explicit step. For the apparel brand we moved generated copy into a _ai_draft_short_description meta field and surfaced it in a review queue. Live content changed only when a merchandiser clicked approve, which stamped the approver and the prompt version on the record.
2. Validate structure and forbidden claims, not vibes
Treat model output like untrusted user input. Parse it, validate it against a schema, and reject it if it fails. Then run a second pass for claims your business can't make. For a regulated beverage portfolio, that list included health terms, ABV figures, and any origin claim not present in the source fields. Anything that trips a rule goes to the queue with the reason attached.
In that rebuild, 2.3% of generations failed validation or tripped a claims rule. Those went to review. None reached the live catalog without a human click.
3. Make missing data a stop condition, not a prompt problem
If a required ACF field is empty, the job should skip the SKU and log it. Don't ask the model to "write around the gaps." It will write around them with confidence. A skipped record is a data-quality ticket. An invented fabric claim is a legal problem.
4. Ship a kill switch and a budget cap
Every LLM call path should check a single option before it runs, and the job should stop itself when it crosses a daily spend threshold. We use the same pattern in the AI Showcase build: a flag that halts all calls in one config change, plus a token budget that fails closed. Roughly:
if (!get_option('ai_copy_enabled') || ai_spend_today() >= AI_DAILY_CAP) { return; }
The first time you need it, you'll want it to be one line.
5. Know which layer serves stale content
Before launch, map every cache that can hold the output: page cache, object cache, CDN, fragment caches in your theme, and any Redis keys your headless frontend reads. Key the cache on a content hash, not just the post ID, so a bad write can't hide behind a warm entry. Then test a purge end to end. Most teams have never done this once.
6. Make the job idempotent and queue it
Run generation through Action Scheduler or a proper queue with retries and backoff. Re-running a batch should produce the same result set and not double-write. Pull the model call off the request path entirely; a product page that waits on a 9-second completion is a page that times out during a traffic spike. After we moved generation to the queue, p95 page latency on the affected templates dropped back to the pre-feature baseline, because nothing on the render path was calling a model anymore.
7. Keep an audit trail you can actually query
Store the model ID, prompt version, input hash, raw output, validation result, and approver for every generated record. When the next incident happens, you want to answer "which 40 products used prompt v3 last Tuesday?" in one query, not in a meeting. The rebuilt system ran on about $41 a month in API spend across roughly 4,100 SKUs, which made the audit table cheap to keep.
What this costs and what it saves
The guardrails added about two weeks of work to the original feature. They also turned a six-hour exposure window into a queue item that a merchandiser could clear in a few minutes. Review time dropped because reviewers were only looking at flagged records, not reading 340 product descriptions to find the three that were wrong. That's the trade I'd make every time: slightly slower to ship, far faster to recover.
The AI features that survive in WordPress are boring. They draft instead of publish, they skip instead of guess, they can be switched off without a deploy, and they leave a paper trail. The ones that don't survive are the ones whose authors never wrote the sentence.
If you can't explain the 2am failure in one sentence, the feature isn't ready, no matter how good the demo looks.
This is the same discipline we bring to WordPress, WooCommerce, and Laravel work at Champlin Enterprises: define the failure path first, then decide how much intelligence the system is allowed to have.