mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
REST API: In WP_REST_Block_Directory_Controller::get_items()
, make sure the blocks data for a plugin is not empty before proceeding.
This avoids a PHP notice if the API returns a plugin with empty data for `blocks` key. Props khag7, TwentyZeroTwo, justinahinon, TimothyBlynJacobs, dd32, SergeyBiryukov. Fixes #51018. Built from https://develop.svn.wordpress.org/trunk@48842 git-svn-id: http://core.svn.wordpress.org/trunk@48604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
23b4fd4a86
commit
ee0943482f
@ -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 );
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-alpha-48841';
|
||||
$wp_version = '5.6-alpha-48842';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user