wp_is_development_mode example


    $cache_group = 'theme_json';
    $cache_key   = 'wp_get_global_settings_' . $origin;

    /* * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme * developer's workflow. */
    $can_use_cached = ! wp_is_development_mode( 'theme' );

    $settings = false;
    if ( $can_use_cached ) {
        $settings = wp_cache_get( $cache_key$cache_group );
    }

    if ( false === $settings ) {
        $settings = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_settings();
        if ( $can_use_cached ) {
            wp_cache_set( $cache_key$settings$cache_group );
        }
    }

function wp_get_global_styles_svg_filters() {
    _deprecated_function( __FUNCTION__, '6.3.0' );

    /* * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme * developer's workflow. */
    $can_use_cached = ! wp_is_development_mode( 'theme' );
    $cache_group    = 'theme_json';
    $cache_key      = 'wp_get_global_styles_svg_filters';
    if ( $can_use_cached ) {
        $cached = wp_cache_get( $cache_key$cache_group );
        if ( $cached ) {
            return $cached;
        }
    }

    $supports_theme_json = wp_theme_has_theme_json();

    
$suffix        = wp_scripts_get_suffix();
    $wp_styles     = wp_styles();
    $style_fields  = array(
        'style'       => 'style',
        'editorStyle' => 'editor',
    );

    /* * Ignore transient cache when the development mode is set to 'core'. Why? To avoid interfering with * the core developer's workflow. */
    if ( ! wp_is_development_mode( 'core' ) ) {
        $transient_name = 'wp_core_block_css_files';
        $files          = get_transient( $transient_name );
        if ( ! $files ) {
            $files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
            set_transient( $transient_name$files );
        }
    } else {
        $files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
    }

    $register_style = static function( $name$filename$style_handle ) use ( $includes_path$includes_url$suffix$wp_styles$files ) {
        
Home | Imprint | This part of the site doesn't use cookies.