diff --git a/inc/Abilities/Content/UpsertPostAbility.php b/inc/Abilities/Content/UpsertPostAbility.php index efa061055..01cc398f3 100644 --- a/inc/Abilities/Content/UpsertPostAbility.php +++ b/inc/Abilities/Content/UpsertPostAbility.php @@ -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.', @@ -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.', @@ -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(); @@ -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.