Skip to content

Commit f0ee469

Browse files
committed
Define default value ​​for comment type as a schema
1 parent 992a3bd commit f0ee469

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ public function create_item( $request ) {
640640
return $prepared_comment;
641641
}
642642

643-
$prepared_comment['comment_type'] = empty( $request['type'] ) ? 'comment' : $request['type'];
643+
$prepared_comment['comment_type'] = $request['type'];
644644

645645
if ( ! isset( $prepared_comment['comment_content'] ) ) {
646646
$prepared_comment['comment_content'] = '';
@@ -1567,6 +1567,7 @@ public function get_item_schema() {
15671567
'type' => 'string',
15681568
'context' => array( 'view', 'edit', 'embed' ),
15691569
'readonly' => true,
1570+
'default' => 'comment',
15701571
),
15711572
),
15721573
);

0 commit comments

Comments
 (0)