wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_enqueue_global_styles › WordPress Function
Since5.8.0
Deprecatedn/a
› wp_enqueue_global_styles ( No parameters )
Defined at: |
|
Codex: |
Enqueues the global styles defined via theme.json.
Related Functions: wp_enqueue_block_style, wp_get_global_styles, wp_enqueue_style, wp_get_global_stylesheet, wp_dequeue_style
Source
function wp_enqueue_global_styles() { $separate_assets = wp_should_load_separate_core_block_assets(); $is_block_theme = wp_is_block_theme(); $is_classic_theme = ! $is_block_theme; /* * Global styles should be printed in the head when loading all styles combined. * The footer should only be used to print global styles for classic themes with separate core assets enabled. * * See https://core.trac.wordpress.org/ticket/53494. */ if ( ( $is_block_theme && doing_action( 'wp_footer' ) ) || ( $is_classic_theme && doing_action( 'wp_footer' ) && ! $separate_assets ) || ( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) && $separate_assets ) ) { return; } $stylesheet = wp_get_global_stylesheet(); if ( empty( $stylesheet ) ) { return; } wp_register_style( 'global-styles', false, array(), true, true ); wp_add_inline_style( 'global-styles', $stylesheet ); wp_enqueue_style( 'global-styles' ); }