Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run template-part registration after all other blocks #3384

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/wp-includes/blocks/template-part.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,8 @@ function register_block_core_template_part() {
)
);
}
add_action( 'init', 'register_block_core_template_part' );
/*
* 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 );
Comment on lines +252 to +256
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we'd need to make this change to the corresponding file in Gutenberg, since Core's build process uses the files from the @wordpress/block-library package as its source of truth for dynamic blocks' PHP code and overwrites any changes we make here 😬

(I think that's also the reason for the test failures we're seeing in CI.)

2 changes: 1 addition & 1 deletion src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down