Skip to content

Commit 1281b44

Browse files
oandregalandrewserong
authored andcommitted
Enqueue the registered assets (#50185)
* Enqueue again the registered assets * Document and protect against 6.1 and 6.2 * Make sure the action runs earlier, as if it was from core * Make linter happy * Fix linting issues --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
1 parent 7eb2a4e commit 1281b44

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/compat/wordpress-6.2/default-filters.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,18 @@
2323
*/
2424
add_action( 'start_previewing_theme', '_gutenberg_clean_theme_json_caches' );
2525
add_action( 'switch_theme', '_gutenberg_clean_theme_json_caches' );
26+
27+
/**
28+
* This is a temporary fix to ensure that the block editor styles are enqueued
29+
* in the order the iframe expects.
30+
*
31+
* The wp_enqueue_registered_block_scripts_and_styles callback has been removed in core
32+
* as of https://github.com/WordPress/wordpress-develop/pull/4356.
33+
*
34+
* However, Gutenberg supports WordPress 6.1 and 6.2, which still have this callback.
35+
* Hence, why we remove it first and then re-add it.
36+
*
37+
* This way we make sure it still works the same in WordPress trunk, 6.1 and 6.2.
38+
*/
39+
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_registered_block_scripts_and_styles' );
40+
add_action( 'enqueue_block_editor_assets', 'wp_enqueue_registered_block_scripts_and_styles', 1 );

0 commit comments

Comments
 (0)