From 1f2fa67110b76069254d974f544de8cd18a2fd40 Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Fri, 30 Sep 2022 10:26:39 -0700 Subject: [PATCH 1/3] Run template-part registration after all other blocks Prioity 22 was chosen because register_legacy_post_comments_block is priority 21 and this should be called afterwards --- src/wp-includes/blocks/template-part.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/blocks/template-part.php b/src/wp-includes/blocks/template-part.php index 107f20dbd35b5..5bea6924c60ad 100644 --- a/src/wp-includes/blocks/template-part.php +++ b/src/wp-includes/blocks/template-part.php @@ -249,4 +249,4 @@ function register_block_core_template_part() { ) ); } -add_action( 'init', 'register_block_core_template_part' ); +add_action( 'init', 'register_block_core_template_part', 22 ); From 8a2c3f390bc7d27f64acb3c4996eb4ce2fdd47e3 Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Fri, 30 Sep 2022 10:37:50 -0700 Subject: [PATCH 2/3] Move WP_Block_Supports::init to priority 30 This gives more breathing room for blocks that want to register themselves in a different order --- src/wp-includes/default-filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 725f5ef3cbce5..fa3fd15a830e8 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -345,7 +345,7 @@ add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); add_action( 'init', '_register_core_block_patterns_and_categories' ); add_action( 'init', 'check_theme_switched', 99 ); -add_action( 'init', array( 'WP_Block_Supports', 'init' ), 22 ); +add_action( 'init', array( 'WP_Block_Supports', 'init' ), 30 ); add_action( 'switch_theme', array( 'WP_Theme_JSON_Resolver', 'clean_cached_data' ) ); add_action( 'start_previewing_theme', array( 'WP_Theme_JSON_Resolver', 'clean_cached_data' ) ); add_action( 'after_switch_theme', '_wp_menus_changed' ); From f4f1bcec2900d812bd1bea045acfb742528604a5 Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Fri, 30 Sep 2022 11:02:09 -0700 Subject: [PATCH 3/3] Update template-part to be registered just prior to WP_Block_Supports --- src/wp-includes/blocks/template-part.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/blocks/template-part.php b/src/wp-includes/blocks/template-part.php index 5bea6924c60ad..d4521ba40b5f9 100644 --- a/src/wp-includes/blocks/template-part.php +++ b/src/wp-includes/blocks/template-part.php @@ -249,4 +249,8 @@ function register_block_core_template_part() { ) ); } -add_action( 'init', 'register_block_core_template_part', 22 ); +/* + * This block relies on generated styles from previously registered blocks, so + * it should be registered last. + */ +add_action( 'init', 'register_block_core_template_part', 29 );