From cc684968ae38a4e20bd7c53d4d25c6408e326835 Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 1 Sep 2021 00:34:58 +0000 Subject: [PATCH] Widgets: Pass correct context to `get_block_categories()` calls. The `get_block_categories()` function expects either a `WP_Post` or a `WP_Block_Editor_Context` instance as the context argument, not a string. Follow-up to [50996], [50997]. Props Enchiridion, pbearne, audrasjb, SergeyBiryukov. Merges [51700] to the 5.8 branch. Fixes #53757. Built from https://develop.svn.wordpress.org/branches/5.8@51711 git-svn-id: http://core.svn.wordpress.org/branches/5.8@51317 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/widgets-form-blocks.php | 2 +- wp-includes/class-wp-customize-widgets.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/widgets-form-blocks.php b/wp-admin/widgets-form-blocks.php index 7f3b6b2f65..95908e1e9e 100644 --- a/wp-admin/widgets-form-blocks.php +++ b/wp-admin/widgets-form-blocks.php @@ -52,7 +52,7 @@ wp_add_inline_script( wp_add_inline_script( 'wp-blocks', - sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( 'widgets-editor' ) ) ), + sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ), 'after' ); diff --git a/wp-includes/class-wp-customize-widgets.php b/wp-includes/class-wp-customize-widgets.php index 9df026d5b2..c96773b139 100644 --- a/wp-includes/class-wp-customize-widgets.php +++ b/wp-includes/class-wp-customize-widgets.php @@ -862,7 +862,7 @@ final class WP_Customize_Widgets { wp_add_inline_script( 'wp-blocks', - sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( 'widgets-customizer' ) ) ), + sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ), 'after' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 9878937339..6b53afe3d0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8.1-alpha-51710'; +$wp_version = '5.8.1-alpha-51711'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.