Make WordPress Core

Changeset 60935


Ignore:
Timestamp:
10/15/2025 06:34:12 AM (2 months ago)
Author:
westonruter
Message:

Bundled Themes: Add path data to block theme stylesheets so they can be inlined.

This adds path data to the enqueued style.css/style.min.css stylesheets for the Twenty Twenty-Two and Twenty Twenty-Five themes. These small stylesheets are eligible for inlining, especially after the minification in [60934].

Props westonruter, ankitkumarshah, sabernhardt, poena, joemcgill, spacedmonkey, swissspidy.
See #63012.
Fixes #63007.

Location:
trunk/src/wp-content/themes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyfive/functions.php

    r60934 r60935  
    5858            array(),
    5959            wp_get_theme()->get( 'Version' )
     60        );
     61        wp_style_add_data(
     62            'twentytwentyfive-style',
     63            'path',
     64            get_parent_theme_file_path( $src )
    6065        );
    6166    }
  • trunk/src/wp-content/themes/twentytwentytwo/functions.php

    r60934 r60935  
    5050        $src    = 'style' . $suffix . '.css';
    5151
    52         wp_register_style(
     52        wp_enqueue_style(
    5353            'twentytwentytwo-style',
    5454            get_parent_theme_file_uri( $src ),
     
    5656            $version_string
    5757        );
    58 
    59         // Enqueue theme stylesheet.
    60         wp_enqueue_style( 'twentytwentytwo-style' );
     58        wp_style_add_data(
     59            'twentytwentytwo-style',
     60            'path',
     61            get_parent_theme_file_path( $src )
     62        );
    6163    }
    6264
Note: See TracChangeset for help on using the changeset viewer.