Skip to content

Instantly share code, notes, and snippets.

@aduth
Created May 29, 2020 17:21
Show Gist options
  • Save aduth/f9b4b9683f6cdd37092d7a99773bcd2f to your computer and use it in GitHub Desktop.
Save aduth/f9b4b9683f6cdd37092d7a99773bcd2f to your computer and use it in GitHub Desktop.
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index e765a03163..f020f4db2f 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -2484,18 +2484,16 @@ function wp_common_block_scripts_and_styles() {
}
/**
- * Enqueues registered block scripts and styles, depending on current rendered
- * context (only enqueuing editor scripts while in context of the editor).
+ * Enqueues all registered block scripts and styles.
*
* @since 5.0.0
+ * @since 5.5.0 Remove conditions for registering in the editor.
*
* @global WP_Screen $current_screen WordPress current screen object.
*/
function wp_enqueue_registered_block_scripts_and_styles() {
global $current_screen;
- $is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor() );
-
$block_registry = WP_Block_Type_Registry::get_instance();
foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {
// Front-end styles.
@@ -2509,12 +2507,12 @@ function wp_enqueue_registered_block_scripts_and_styles() {
}
// Editor styles.
- if ( $is_editor && ! empty( $block_type->editor_style ) ) {
+ if ( ! empty( $block_type->editor_style ) ) {
wp_enqueue_style( $block_type->editor_style );
}
// Editor script.
- if ( $is_editor && ! empty( $block_type->editor_script ) ) {
+ if ( ! empty( $block_type->editor_script ) ) {
wp_enqueue_script( $block_type->editor_script );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment