Here is a question worth putting to whoever runs your publishing pipeline, in-house or outsourced: what proof do you have that a post is actually on the site in the state you asked for, five minutes after the automation said it was?
Not what the deploy log said. Not what the HTTP response code said. Proof. The category you asked for, attached to the post, in the archive, visible to the reader. The failure mode that quietly costs an organisation money is not the one that crashes with a red banner. It is the one that returns a polite 201 Created and goes home.
We run our own daily pipeline against our own two sites, English and Turkish, one post a day, scheduled. Over the last two months it has reported success while silently losing data more times than I would like to write down. The fixes are not glamorous. They are the sort of thing you ask for when you are deciding who should operate your content infrastructure. The pattern travels, too: any CMS behind an API, any automation fanning out to more than one site, has the same class of problem waiting. Here is what broke, in order, and what it cost us.
The Constraint Was Not the Publishing, It Was the Trust
The job is modest on paper. A scheduled process writes two Gutenberg-block HTML files, English and Turkish, and publishes each to its WordPress site over the REST API. Each post wants a title, a slug, an excerpt, three to six tags, and one to three top-level categories from a fixed list. The authentication is a WordPress application password. The sites are our own, which means the failure mode when something goes wrong is embarrassment rather than a client bill, and that is the only reason I am willing to write this up.
The real constraint was not publishing the content. The REST API accepts a post body all day. The constraint was proving to ourselves that the post was published in the state we asked for, without a human checking the archive by eye. If we cannot prove that on our own estate, we have no business selling the same pipeline to a buyer whose estate is a hundred times more complicated.
Four Ways That Did Not Work, in the Order We Hit Them
The pipeline went through four wrong answers before the current shape. Each logged success and left the site in a state we had not asked for.
1. Rely on the REST categories endpoint, under an application password
First attempt. The pipeline reads the list of existing top-level categories, maps the names it has in hand to IDs, and sends the IDs back in the REST POST that creates the post. Standard. The categories endpoint returned 403 Forbidden to the authenticated read on every run, on both sites. The same read works perfectly as an unauthenticated public call, from a browser or from curl; it 403s the moment the application-password Authorization header appears. Not what any documentation says will happen, but it is what the server does.
What it cost us: three days of posts went up without any category attached, because the pipeline could not resolve the names and shipped without them. The archive at /category/blog/ was empty on new entries. Nothing in the run log mentioned it; from the pipeline’s point of view, the publish had succeeded.
2. Treat HTTP 201 as proof the categories attached
Second attempt. Having resolved the names by another route (the public-read fetch still responds for anyone), we sent the IDs in the categories field of the POST body. The server returned 201 Created. We logged “OK” and moved on. When one of us finally went to look, the posts were live, the URLs resolved, and the categories array on the created resource came back empty. The categories we had just sent had been silently dropped.
What it cost us: another week of manual follow-up passes to attach categories by hand. Two sites, two languages, roughly ten minutes per post. Not ruinous on a daily blog. On a publisher running a hundred posts a day it is a full headcount.
The lesson here is small and non-negotiable. A 201 proves the request was accepted. It does not prove the server did what the request asked. For anything that carries taxonomy, foreign keys, or ordering, the response body has to be read back and compared against intent, not scanned for a status code.
3. Fall back to wp-cli over SSH, with the category IDs on the command line
Third attempt, and the one that produced the incident this post exists to warn about. If REST drops the categories, run wp post term set <post_id> category 1 129 130 over SSH after each publish, with the resolved IDs. Clean, and the sort of thing that reads sensibly in a shell history.
On 2026-10-14 the run finished and the English site, then the Turkish site, each quietly grew three new top-level categories named, literally, 1, 129 and 130. The post we had just published was correctly attached to all three of them. The actual categories we wanted (Blog, Enterprise Solutions, Advanced Solutions on the English site, their Turkish equivalents on the other) were not touched. The archive pages for the new numeric categories existed. Google would have indexed them given time.
The cause took about four minutes to find. wp post term set defaults to treating its trailing arguments as term names. Passing 1 129 130 does not look up terms by ID; it creates three new terms whose names happen to be the characters “1”, “129” and “130”, and attaches the post to them. The flag that makes the command treat its arguments as IDs is --by=id. Without it, the command does the wrong thing in silence, exits zero, and prints a success message.
The cleanup was not expensive in minutes. It was expensive in confidence. Automation that fails silently teaches you not to trust the state, and once you do not trust the state, every subsequent run costs more to reason about.
4. Pass tags through the shell by word-splitting on whitespace
A smaller cousin of the third, with the same shape. The fallback script, when attaching tags over SSH, iterated the tag list with an unquoted command substitution, so the shell word-split on whitespace. A tag like AI customer service reached wp as three separate arguments: AI, customer, service. The command created three new tags of those names and attached the post to all three.
Cost: a small, tidy pollution of the tag taxonomy, with orphan tags that read like broken sentences. The two bugs, three and four, share a cause: scripted automation feeding an interface designed for a human typing at a prompt.
What We Landed On, and Why That Is the Policy Not the Flag
The pipeline still runs the same four underlying operations, in the same order, against the same two surfaces. The difference is three decisions that stand above any individual flag or endpoint.
First decision: the pipeline resolves category names to IDs in its own Python code, at publish time, by reading the public /wp-json/wp/v2/categories?parent=0 listing. That endpoint responds without the broken application-password path getting involved, and we never send a name downstream where a command might interpret it as a request to create something. Everything that reaches wp-cli is an integer ID.
Second decision: wp post term set is invoked only with the explicit --by=id flag, on every call, including the ones that are not strictly ambiguous today. The whole class of silent-create behaviour is prevented by the flag and not by our ability to remember when it is needed. A policy that depends on a person remembering is a policy that fails the week they are busy.
Third decision, and the one that matters most: the REST response body is compared against intent before the publish is treated as done. If we sent three category IDs and the response’s categories array is empty, the pipeline falls through to the SSH wp-cli path. Same for tags. The fallback is logged on stderr with the post ID and the exact IDs it is going to attach, so when a run’s log is read a week later it is obvious that a fallback happened, and what it did. Silent fallbacks are what let the first three attempts stay broken for as long as they did.
The tag-splitting bug is fixed by building each tag as its own single-quoted shell argument, with embedded quotes properly escaped for the remote shell.
The Measured Result Is That Nothing Interesting Has Happened Since
Between 2026-10-14 and 2026-11-22, the pipeline has published 39 posts across the two languages, 78 publish events. Zero posts have shipped without their intended categories attached. Zero spurious categories created. Zero spurious tags created. The three numeric categories from the original incident were deleted the same day and have not reappeared. The fallback from REST to SSH wp-cli has fired on every run since, because the underlying REST-categories-under-auth bug is still there, and every fire is visible in the run log without being asked to look for it.
The headline is that the headline is boring, and the boredom is the point. When automation is doing what you asked, there is nothing to say about it. When it is not, you want to find out before an archive page starts collecting indexed URLs that do not belong to anyone.
What I Would Do Differently if We Were Starting the Pipeline Today
Two things. First, I would have written the intent-versus-response check into the first version, not the fourth. It is twenty minutes of code. It took us four attempts to get there because the first bug looked like a WordPress problem and the second looked like a REST problem, and only the third made it obvious that the real problem was our willingness to accept an HTTP 201 as evidence of state. If we had started from the policy, the specific endpoints and flags would have lined up behind it.
Second, I would have retired the broken REST categories path earlier. We kept trying to make it work for weeks after confirming it returns 403 under auth and 200 without, which is a configuration quirk at the host level we were never going to fix from the client. Carrying a known-broken path alongside the workaround is debt that you understand, and debt you understand is still debt.
Building This Into a Real WooCommerce or WordPress VIP Pipeline on Monday
If you are evaluating a publishing pipeline, or the team operating yours, there are three questions I would put in front of them before anything else.
First: what is the evidence that a published post has the taxonomy you asked for, after the fact? If the answer is “the API returned 201 Created”, you have the first bug on this list waiting to happen. The honest answer is a comparison of the response body’s categories and tags arrays against the values the pipeline sent. If the answer involves manually checking the archive page afterwards, you have paid for automation and gotten a reminder system.
Second: when the primary path fails and the fallback fires, where does that get logged, and who reads it? A fallback that is not visible is a silent failure dressed up as a feature. Good answers point at structured logs collected off the run host or a stderr stream captured into the same run record as the success message. Bad answers are a shrug.
Third: who owns the taxonomy as a schema? When a name does not exist on the site, does the pipeline create it, log it and skip, or stop with an error? A pipeline that silently creates is fine for a fast-moving blog and poisonous for a regulated newsroom. A pipeline that stops with an error is appropriate for a VIP install where the archive structure is part of how the site is sold to its own readers. The right answer depends on who you are. The wrong answer is “we have not thought about it”.
Inside a real WooCommerce or WordPress VIP estate, retrofitting this is two or three days of engineering: response verification, structured logging, and a per-publish assertion that compares intent against state. Cheaper than any one of the incidents in this post cost us, and cheaper by a wide margin than any one of them would cost on a store doing real money.
The bug in this story is small. The shape is not. Automation that fails politely, returning the status code it is supposed to return and logging the success message it is supposed to log, is the pattern that eats operational time. The fix is less about any particular flag and more about a rule a team holds itself to: every automated step proves the thing happened, not that the request was accepted. If you are looking at your own pipeline this week and are not sure which side of that rule it sits on, that is probably the first conversation to have. We are happy to have it with you.
Last modified: November 23, 2026