wp_get_global_styles_svg_filters() WordPress Function
The wp_get_global_styles_svg_filters() function is used to get the global styles for SVG filters.
wp_get_global_styles_svg_filters() #
Returns a string containing the SVGs to be referenced as filters (duotone).
Return
(string)
Source
File: wp-includes/global-styles-and-settings.php
function wp_get_global_styles_svg_filters() { // Return cached value if it can be used and exists. // It's cached by theme to make sure that theme switching clears the cache. $can_use_cached = ( ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) && ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) && ! is_admin() ); $transient_name = 'global_styles_svg_filters_' . get_stylesheet(); if ( $can_use_cached ) { $cached = get_transient( $transient_name ); if ( $cached ) { return $cached; } } $supports_theme_json = WP_Theme_JSON_Resolver::theme_has_support(); $origins = array( 'default', 'theme', 'custom' ); if ( ! $supports_theme_json ) { $origins = array( 'default' ); } $tree = WP_Theme_JSON_Resolver::get_merged_data(); $svgs = $tree->get_svg_filters( $origins ); if ( $can_use_cached ) { // Cache for a minute, same as wp_get_global_stylesheet. set_transient( $transient_name, $svgs, MINUTE_IN_SECONDS ); } return $svgs; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.9.1 | Introduced. |