Home / Admin / Load all Customizer “Additional CSS” in Block Editor
Duplicate Snippet

Embed Snippet on Your Site

Load all Customizer “Additional CSS” in Block Editor

The CSS added to the frontend via the Customizer does not get added to the block editor by default. This changes that.

Keep in mind, the block editor styles may have higher specificity than the selectors used.

Code Preview
php
<?php
// Load the Frontend customizer "Additonal CSS" in the block editor.
add_action( 'enqueue_block_editor_assets', 'wp_custom_css_cb' );
// Uncomment below if you need to manually manipulate the CSS for the block editor.
// add_action( 'enqueue_block_editor_assets', function() {
// 	ob_start();
// 	wp_custom_css_cb();
// 	$content = ob_get_clean();
// 	echo str_replace(
// 		[
// 			'.bpress-article-content'
// 		], [
// 			'.editor-styles-wrapper',
// 		],
// 		$content
// );
// }, 101 );

Comments

Add a Comment