All-or-nothing writes: validation (fields, terms, featured image, parent, template) before any write; failed extras delete the new draft (create) or restore revision, old columns, fields, terms and featured image (update). content-update requires rev; Rev::ofPost covers content, title, excerpt, status and post_modified_gmt. MetaFieldSource::write() now throws on failure. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
if (! class_exists('WP_Post')) {
|
|
/**
|
|
* Minimal WP_Post: untyped public properties like the real class.
|
|
*/
|
|
class WP_Post
|
|
{
|
|
public $ID = 0;
|
|
public $post_type = 'post';
|
|
public $post_status = 'draft';
|
|
public $post_title = '';
|
|
public $post_content = '';
|
|
public $post_excerpt = '';
|
|
public $post_name = '';
|
|
public $post_parent = 0;
|
|
public $menu_order = 0;
|
|
public $post_author = '1';
|
|
public $post_date = '2026-09-25 10:00:00';
|
|
public $post_date_gmt = '2026-09-25 08:00:00';
|
|
public $post_modified = '2026-09-25 10:00:00';
|
|
public $post_modified_gmt = '2026-09-25 08:00:00';
|
|
public $post_mime_type = '';
|
|
public $comment_status = 'closed';
|
|
public $ping_status = 'closed';
|
|
public $post_password = '';
|
|
|
|
/** @param array<string, mixed> $fields */
|
|
public function __construct(array $fields = [])
|
|
{
|
|
foreach ($fields as $key => $value) {
|
|
$this->{$key} = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|