Hooks inline styles in the proper place, depending on the active theme.
Parameters
$style
stringrequired- String containing the CSS styles to be added.
$priority
intoptional- To set the priority for the add_action.
Default:
10
Source
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
);
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.