wp_enqueue_block_support_styles()
Hooks inline styles in the proper place, depending on the active theme.
For block themes, styles are loaded in the head. For classic ones, styles are loaded in the body because the wp_head action happens before render_block.
No Hooks.
Return
null
. Nothing (null).
Usage
wp_enqueue_block_support_styles( $style, $priority );
- $style(string) (required)
- String containing the CSS styles to be added.
- $priority(int)
- To set the priority for the add_action.
Default: 10
Changelog
Since 5.9.1 | Introduced. |
Since 6.1.0 | Added the $priority parameter. |
wp_enqueue_block_support_styles() wp enqueue block support styles code WP 6.7.1
function wp_enqueue_block_support_styles( $style, $priority = 10 ) { $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"; }, $priority ); }