Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions inc/Abilities/Content/UpsertPostAbility.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ private function register_ability(): void {
'type' => 'string',
'description' => 'Post status for create path. Defaults to publish.',
),
'post_author' => array(
'type' => 'integer',
'description' => 'Post author user ID. Only applied on create; ignored on update.',
),
'post_excerpt' => array(
'type' => 'string',
'description' => 'Post excerpt.',
Expand Down Expand Up @@ -215,6 +219,10 @@ public static function getChatTool(): array {
'type' => 'string',
'description' => 'Slash-delimited parent path (e.g. "artist/link-pages").',
),
'post_author' => array(
'type' => 'integer',
'description' => 'Post author user ID (create only).',
),
'content_hash' => array(
'type' => 'string',
'description' => 'Hash for idempotency check.',
Expand Down Expand Up @@ -254,6 +262,7 @@ public static function execute( array $input ): array {
$content_hash = $input['content_hash'] ?? '';
$raw_source = $input['raw_source'] ?? '';
$post_status = sanitize_key( $input['post_status'] ?? 'publish' );
$post_author = absint( $input['post_author'] ?? 0 );
$post_excerpt = $input['post_excerpt'] ?? '';
$taxonomies = $input['taxonomies'] ?? array();
$meta_input = $input['meta_input'] ?? array();
Expand Down Expand Up @@ -345,6 +354,9 @@ public static function execute( array $input ): array {
$action = 'updated';
} else {
$action = 'created';
if ( $post_author > 0 ) {
$post_data['post_author'] = $post_author;
}
}

// Merge caller-supplied meta_input.
Expand Down
Loading