diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php index c2069b21bc..089a5215ba 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php @@ -95,6 +95,11 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller { $result = array(); foreach ( $response->plugins as $plugin ) { + // If the API returned a plugin with empty data for 'blocks', skip it. + if ( empty( $plugin['blocks'] ) ) { + continue; + } + $data = $this->prepare_item_for_response( $plugin, $request ); $result[] = $this->prepare_response_for_collection( $data ); }