Skip to content

Commit f38e747

Browse files
Finalized the enable disable add the customize css
1 parent bde318d commit f38e747

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

php/Admin.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -566,21 +566,18 @@ public function admin_page() {
566566
public function check_options_and_implement() {
567567
$options = Options::get_options();
568568
if ( $options['loadCustomizerCSSBlockEditor'] ) {
569-
add_action('enqueue_block_editor_assets', array( $this, 'enqueue_custom_css' ), PHP_INT_MAX );
570-
add_action('wp_footer', array( $this, 'enqueue_custom_css' ), PHP_INT_MAX );
569+
add_action('enqueue_block_assets', array( $this, 'enqueue_custom_css_admin' ), PHP_INT_MAX );
571570
}
572571
}
573-
574572
/**
575-
* Function enqueue the custom css from theme customizer using enqueue block assets
573+
* Function enqueue on wp-edit-blocks
576574
*/
577575

578-
public function enqueue_custom_css() {
576+
public function enqueue_custom_css_admin() {
579577
$custom_css = wp_get_custom_css();
580-
if (!empty($custom_css)) {
581-
$theme = wp_get_theme(); // Get the current theme object
582-
$theme_handle = $theme->get_stylesheet();
583-
wp_add_inline_style($theme_handle, $custom_css);
578+
if ( ! empty( $custom_css )) {
579+
wp_add_inline_style( 'wp-edit-blocks', $custom_css );
584580
}
585581
}
582+
586583
}

0 commit comments

Comments
 (0)