From 62e8eda2f14e9cb25b66383f37206fc92e204cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Wed, 14 Dec 2022 13:22:31 +0100 Subject: [PATCH] compat/6.1: add missing backport for constructor https://github.com/WordPress/gutenberg/pull/44658 --- lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php b/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php index 9c74468c683be3..167ee63e2a2cac 100644 --- a/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php +++ b/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php @@ -522,7 +522,8 @@ public function __construct( $theme_json = array(), $origin = 'theme' ) { } $this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json ); - $valid_block_names = array_keys( static::get_blocks_metadata() ); + $registry = WP_Block_Type_Registry::get_instance(); + $valid_block_names = array_keys( $registry->get_all_registered() ); $valid_element_names = array_keys( static::ELEMENTS ); $theme_json = static::sanitize( $this->theme_json, $valid_block_names, $valid_element_names ); $this->theme_json = static::maybe_opt_in_into_settings( $theme_json );