Skip to content

Styles coming from __experimentalStyles are not enqueued in the post editor for themes without theme.json #46818

Closed

Description

@oandregal

Raised at #45731

Steps to reproduce:

  • Activate the TwentyTwenty theme.
  • Load the post editor.
  • Add a pullquote block.
  • Search for .editor-styles-wrapper .wp-block-pullquote.

The expected behavior is that there should be a style rule containing the font size and line height defined in the __experimentalStyle of the pullquote block embedded into the HTML document. However, that style rule is not present.

Activity

  1. added
    [Type] Bug
    Global Styles
    on Dec 29, 2022
  2. carolinan commented on Jan 23, 2023

    @carolinan
    Contributor

    This could be done with a conditional add_action( 'enqueue_block_editor_assets', 'global-styles' ); But it adds all the global styles.
    Are we looking for a solution that only adds the styles from block.json __experimentalStyle?

  3. carolinan commented on Mar 14, 2023

    @carolinan
    Contributor

    Should the style not be added to classic.scss? It is loaded with https://developer.wordpress.org/reference/functions/wp_enqueue_classic_theme_styles/
    In 6.2 it uses wp_theme_has_theme_json() :

    function wp_enqueue_classic_theme_styles() {
    	if ( ! wp_theme_has_theme_json() ) {
    		$suffix = wp_scripts_get_suffix();
    		wp_register_style( 'classic-theme-styles', '/' . WPINC . "/css/classic-themes$suffix.css" );
    		wp_enqueue_style( 'classic-theme-styles' );
    	}
    }
    
  4. t-hamano commented on Mar 30, 2026

    @t-hamano
    Contributor

    I confirmed that this problem has been fixed. I suspect it's related to the classic theme internally supporting global styles. #73971

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global Styles[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions