W3cubDocs

/WordPress

enqueue_block_styles_assets()

Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend.

Source

File: wp-includes/script-loader.php

function enqueue_block_styles_assets() {
	$block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered();

	foreach ( $block_styles as $styles ) {
		foreach ( $styles as $style_properties ) {
			if ( isset( $style_properties['style_handle'] ) ) {
				wp_enqueue_style( $style_properties['style_handle'] );
			}
			if ( isset( $style_properties['inline_style'] ) ) {
				wp_add_inline_style( 'wp-block-library', $style_properties['inline_style'] );
			}
		}
	}
}

Changelog

Version Description
5.3.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/enqueue_block_styles_assets