wp_get_global_styles_svg_filters() – Returns a string containing the SVGs to be referenced as filters (duotone).

You appear to be a bot. Output may be restricted

Description

Returns a string containing the SVGs to be referenced as filters (duotone).

Usage

$string = wp_get_global_styles_svg_filters();

Parameters

Returns

string

Source

File name: wordpress/wp-includes/global-styles-and-settings.php
Lines:

1 to 34 of 34
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;
}
 

 View on GitHub View on Trac