fix(wordpress): use status=future for posts with a future scheduled_publish_at
WordPress ignores the date field for draft posts and shows "Sofort veröffentlichen" instead. Setting status=future causes WP to display and honour the scheduled date, auto-publishing the post at the given time as intended. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8c6022fead
commit
426a799371
1 changed files with 8 additions and 0 deletions
|
|
@ -446,6 +446,14 @@ def publish_article_draft(article: dict[str, Any]) -> tuple[int, str | None]:
|
|||
scheduled_at = article.get("scheduled_publish_at")
|
||||
if scheduled_at:
|
||||
payload["date"] = scheduled_at # e.g. "2026-03-24T09:00:00"
|
||||
# Use status "future" so WP schedules auto-publishing at the given date.
|
||||
# WP ignores date for drafts and shows "Sofort veröffentlichen" instead.
|
||||
try:
|
||||
from datetime import datetime as _dt
|
||||
if _dt.fromisoformat(scheduled_at) > _dt.now():
|
||||
payload["status"] = "future"
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
wp_post_id = article.get("wp_post_id")
|
||||
tag_ids = _resolve_wp_tag_ids(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue