Skip to content

Commit 63e391d

Browse files
Embedding children for notes requires type and status inheritance
1 parent eedfea8 commit 63e391d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,22 @@ protected function prepare_links( $comment ) {
12711271
);
12721272
}
12731273

1274+
// Embedding children for notes requires `type` and `status` inheritance.
1275+
if ( isset( $links['children'] ) && 'note' === $comment->comment_type ) {
1276+
$args = array(
1277+
'parent' => $comment->comment_ID,
1278+
'type' => $comment->comment_type,
1279+
'status' => 'all',
1280+
);
1281+
1282+
$rest_url = add_query_arg( $args, rest_url( $this->namespace . '/' . $this->rest_base ) );
1283+
1284+
$links['children'] = array(
1285+
'href' => $rest_url,
1286+
'embeddable' => true,
1287+
);
1288+
}
1289+
12741290
return $links;
12751291
}
12761292

0 commit comments

Comments
 (0)