[wp-trac] [WordPress Trac] #64166: Twenty Twenty: Update theme to add Gutenberg styles and support
WordPress Trac
noreply at wordpress.org
Wed Oct 29 22:52:24 UTC 2025
#64166: Twenty Twenty: Update theme to add Gutenberg styles and support
---------------------------+-------------------------------
Reporter: westonruter | Owner: westonruter
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.9
Component: Bundled Theme | Version: 5.3
Severity: normal | Resolution:
Keywords: has-patch | Focuses: css, performance
---------------------------+-------------------------------
Comment (by westonruter):
A better alternative which I haven't fully fleshed out yet:
{{{#!diff
diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
index a8ed76d3bd..e2307fbd03 100644
--- a/src/wp-includes/blocks.php
+++ b/src/wp-includes/blocks.php
@@ -506,9 +506,11 @@ function register_block_type_from_metadata(
$file_or_folder, $args = array() ) {
if ( ! isset( $metadata['style'] ) ) {
$metadata['style'] = "wp-block-$block_name";
}
- if ( current_theme_supports( 'wp-block-styles' ) &&
wp_should_load_separate_core_block_assets() ) {
- $metadata['style'] = (array) $metadata['style'];
- $metadata['style'][] = "wp-
block-{$block_name}-theme";
+ if ( wp_should_load_separate_core_block_assets() ) {
+ $metadata['style'] = (array) $metadata['style'];
+ if ( current_theme_supports( 'wp-block-styles' ) )
{
+ $metadata['style'][] = "wp-
block-{$block_name}-theme";
+ }
}
if ( ! isset( $metadata['editorStyle'] ) ) {
$metadata['editorStyle'] = "wp-
block-{$block_name}-editor";
}}}
With #64150, however, Twenty Twenty would also need to explicitly opt-in
to with:
{{{#!php
<?php
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
add_filter( 'should_load_block_assets_on_demand', '__return_true' );
}}}
Since as of r61076, `wp_load_classic_theme_block_styles_on_demand()` only
does that when the theme supports `wp-block-styles`.
Ultimately, the scope for this ticket is no longer about adding `wp-block-
styles` theme support to Twenty Twenty, but rather about ensuring that
themes which don't explicitly opt-in to `wp-block-styles` are still able
to benefit from styles being loaded separately and on-demand.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64166#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list