wp_enqueue_block_support_styles() WordPress Function
The wp_enqueue_block_support_styles() function is used to enqueue styles for blocks. This function should be called inside the block editor initialization function.
wp_enqueue_block_support_styles( string $style ) #
This function takes care of adding inline styles in the proper place, depending on the theme in use.
Parameters
- $style
(string)(Required)String containing the CSS styles to be added.
Source
File: wp-includes/script-loader.php
function wp_enqueue_block_support_styles( $style ) {
$action_hook_name = 'wp_footer';
if ( wp_is_block_theme() ) {
$action_hook_name = 'wp_head';
}
add_action(
$action_hook_name,
static function () use ( $style ) {
echo "<style>$style</style>\n";
}
);
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 5.9.1 | Introduced. |