fix: status tools report a hook throwing during the write as partial_write
publish/unpublish/schedule/trash run their WordPress call through StatusWrite: a throwing hook becomes WriteFailed (rollback incomplete, with post_id) and is logged with result partial instead of surfacing as internal_error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -108,13 +108,20 @@ final class PostScheduleAbility implements Ability
|
||||
}
|
||||
|
||||
$postId = (int) $post->ID;
|
||||
$result = wp_update_post([
|
||||
$data = [
|
||||
'ID' => $postId,
|
||||
'post_status' => 'future',
|
||||
'post_date' => $date->format('Y-m-d H:i:s'),
|
||||
'post_date_gmt' => $date->setTimezone(new DateTimeZone('UTC'))->format('Y-m-d H:i:s'),
|
||||
'edit_date' => true,
|
||||
], true);
|
||||
];
|
||||
$result = StatusWrite::run(
|
||||
static fn () => wp_update_post($data, true),
|
||||
$this->name(),
|
||||
$this->log,
|
||||
$post,
|
||||
'WordPress hat beim Planen einen Fehler gemeldet.'
|
||||
);
|
||||
if ($result instanceof WP_Error) {
|
||||
return Errors::invalidInput('WordPress hat das Planen abgelehnt: ' . $result->get_error_message());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user