Skip to content

Rewrite post title and excerpt on update in publish-post - #212

Merged
jasperf merged 1 commit into
mainfrom
fix/publish-post-update-title
Sep 3, 2026
Merged

Rewrite post title and excerpt on update in publish-post#212
jasperf merged 1 commit into
mainfrom
fix/publish-post-update-title

Conversation

@jasperf

@jasperf jasperf commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Stacked on #211 — base is fix/publish-post-wp-slash, so review that one first. Retarget to main once it merges.

Follows up the note at the end of #210.

Problem

publish-post --update wrote only post_content. Everything else on the update path came from the draft header and was rewritten on every run — SEO meta title, meta description, tags, category, featured image — but the post's own post_title and post_excerpt were not.

The result is incoherent rather than merely incomplete: a title corrected in the draft stays stale on the post while _genesis_title, derived from that same header, is updated to the corrected version. On one post a "WooComerce" typo survived an update that changed everything else, which is what surfaced this.

Change

The update path now writes post_title and post_excerpt alongside the body. The draft header is authoritative for both.

This is a behavior change, hence the minor bump to 5.17.0 rather than a patch. Anyone relying on the post title surviving an update will find it no longer does.

Deliberately not changed

  • post_name — rewriting a slug silently breaks the live URL and needs a redirect that this tool has no business creating. When the draft's slug differs from the stored one, publish-post now warns and leaves it alone, so the drift is visible without acting on it.
  • post_status — an update must not flip a draft live. --status remains create-only.

Both are commented in place so the omission reads as a decision rather than the same oversight repeating.

Verification

  • bash -n passes; the shell worker was regenerated with UPDATE_ID set and a \"-containing title, then linted with php -l under PHP 8.5 — valid, with the new warning and both fields correctly escaped through the heredoc
  • The new WARN: line follows the existing convention in the script and is picked up by the established grep -E '^(WARN|ABORT|ERROR):' handler, so it prints through print_warn like the category and tag warnings
  • tsc --noEmit passes; the built dist/tools/publishPost.js carries both the warn_slug emit and its parsing
  • Title and excerpt are wp_slash()-wrapped, consistent with Slash post content before writing in publish-post #211

The update path wrote only post_content, while the SEO meta title and
description were rewritten from the draft header on every run. A title
corrected in the draft therefore stayed stale on the post even as the
SEO title it should match was updated; on one post a "WooComerce" typo
survived an update that changed everything else.

The draft header is the source of truth for both fields, so the update
now writes post_title and post_excerpt alongside the body.

post_name and post_status stay untouched on update: rewriting a slug
would silently break the live URL, and an update must not flip a draft
live. A slug that differs from the draft now raises a warning instead,
leaving the redirect decision to a human.
Base automatically changed from fix/publish-post-wp-slash to main September 3, 2026 04:47
@jasperf
jasperf merged commit 555bd86 into main Sep 3, 2026
@jasperf
jasperf deleted the fix/publish-post-update-title branch September 3, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant