--- a/wp/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php Fri Sep 05 18:40:08 2025 +0200
@@ -119,6 +119,8 @@
// Restores the more descriptive, specific name for use within this method.
$plugin = $item;
+ $fields = $this->get_fields_for_response( $request );
+
// There might be multiple blocks in a plugin. Only the first block is mapped.
$block_data = reset( $plugin['blocks'] );
@@ -146,7 +148,10 @@
$this->add_additional_fields_to_object( $block, $request );
$response = new WP_REST_Response( $block );
- $response->add_links( $this->prepare_links( $plugin ) );
+
+ if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
+ $response->add_links( $this->prepare_links( $plugin ) );
+ }
return $response;
}