In the block editor for posts and pages, I used to use the enqueue_block_editor_assets hook to enqueue styles for the block.

add_action( 'enqueue_block_editor_assets','load_assets_in_block' );
function load_assets_in_block() {
                plugins_url( 'assets/css/block-style.css', PLAYER_PLUGIN ),

This still works on posts and pages block, but it isn't working on the new site editor in WordPress 5.9? What is the recommended way to enqueue styles in site editor?

  • I am having this same issue too. In the site editor, the styles load but all of the blocks are loaded inside an iframe where the styles are not loaded. So they are not applied to the blocks and they are unstyled. I have a feeling this is an issue in Wordpress more than anything.
    – JoeMoe1984
    Commented Mar 30, 2022 at 18:09

1 Answer 1


So apparently for the site editor, you need to add the styles a little bit differently. You need to use the add_editor_style function.

add_action('after_setup_theme', 'my_add_editor_styles_to_full_site_editing');

function my_add_editor_styles_to_full_site_editing()

Becareful how you style your stylesheet

This function adds your styles inline wrapped in the .editor-styles-wrapper class.

  • 1
    Just a heads-up: since 5.9, add_theme_support( 'editor-styles' ); are included by default for block themes, so it's unnecessary for this type of theme (source). Commented Aug 25, 2022 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.