Skip to content

Commit b47e1c7

Browse files
Twenty Twenty-One: Only enqueue block editor assets in the admin.
Follow-up to [56300]. Props sabernhardt, flixos90, luisherranz, gautam23, huzaifaalmesbah, mukesh27, r1k0, SergeyBiryukov. Fixes #60111. git-svn-id: https://develop.svn.wordpress.org/trunk@61471 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 79c20d8 commit b47e1c7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-custom-colors.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ public function __construct() {
2323
add_action( 'wp_enqueue_scripts', array( $this, 'custom_color_variables' ) );
2424

2525
// Enqueue color variables for editor.
26-
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
26+
if ( is_admin() ) {
27+
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
28+
}
2729

2830
// Add body-class if needed.
2931
add_filter( 'body_class', array( $this, 'body_class' ) );

src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ class Twenty_Twenty_One_Dark_Mode {
2020
public function __construct() {
2121

2222
// Enqueue assets for the block-editor.
23-
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
23+
if ( is_admin() ) {
24+
add_action( 'enqueue_block_assets', array( $this, 'editor_custom_color_variables' ) );
25+
}
2426

2527
// Add styles for dark-mode.
2628
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

0 commit comments

Comments
 (0)