wp_get_global_styles()
Gets the styles resulting of merging core, theme, and user data.
Хуков нет.
Возвращает
Массив
. The styles to retrieve.
Использование
wp_get_global_styles( $path, $context );
- $path(массив)
- Path to the specific style to retrieve. Optional. If empty, will return all styles.
По умолчанию: array() - $context(массив)
Metadata to know where to retrieve the $path from. Optional.
По умолчанию: array()
-
block_name(строка)
Which block to retrieve the styles from. If empty, it'll return the styles for the global context. - origin(строка)
Which origin to take data from. Valid values are 'all' (core, theme, and user) or 'base' (core and theme). If empty or unknown, 'all' is used.
-
Список изменений
С версии 5.9.0 | Введена. |
Код wp_get_global_styles() wp get global styles WP 6.1.1
function wp_get_global_styles( $path = array(), $context = array() ) { if ( ! empty( $context['block_name'] ) ) { $path = array_merge( array( 'blocks', $context['block_name'] ), $path ); } $origin = 'custom'; if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) { $origin = 'theme'; } $styles = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_raw_data()['styles']; return _wp_array_get( $styles, $path, $styles ); }