From cac0947d9053af985af9f3e31a035520b2a2fce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Tue, 11 Feb 2020 13:29:27 +0100 Subject: [PATCH] Enqueue assets in a way that works for edit-site --- lib/global-styles.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/global-styles.php b/lib/global-styles.php index a5c786d6da951b..84fde4d4039f29 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -322,6 +322,8 @@ function gutenberg_experimental_global_styles_register_cpt() { add_action( 'init', 'gutenberg_experimental_global_styles_register_cpt' ); add_filter( 'body_class', 'gutenberg_experimental_global_styles_wp_gs_class_front_end' ); add_filter( 'admin_body_class', 'gutenberg_experimental_global_styles_wp_gs_class_editor' ); - add_action( 'enqueue_block_assets', 'gutenberg_experimental_global_styles_enqueue_assets' ); add_filter( 'block_editor_settings', 'gutenberg_experimental_global_styles_settings' ); + // enqueue_block_assets is not fired in edit-site, so we use back/front hooks instead. + add_action( 'wp_enqueue_scripts', 'gutenberg_experimental_global_styles_enqueue_assets' ); + add_action( 'admin_enqueue_scripts', 'gutenberg_experimental_global_styles_enqueue_assets' ); }