Make WordPress Core

Changeset 60459


Ignore:
Timestamp:
07/15/2025 12:25:45 PM (9 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Remove extra check in wp_get_theme_data_template_parts().

The false === $metadata check would always be true, as a non-false value causes an early return right before. To clarify this behavior, the needless priming of $metadata = false was removed as well, as there is no scenario where it will not be immediately overwritten.

Follow-up to [56385].

Props justlevine.
See #63268.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/global-styles-and-settings.php

    r59823 r60459  
    484484    $can_use_cached = ! wp_is_development_mode( 'theme' );
    485485
    486     $metadata = false;
    487486    if ( $can_use_cached ) {
    488487        $metadata = wp_cache_get( $cache_key, $cache_group );
     
    492491    }
    493492
    494     if ( false === $metadata ) {
    495         $metadata = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_template_parts();
    496         if ( $can_use_cached ) {
    497             wp_cache_set( $cache_key, $metadata, $cache_group );
    498         }
     493    $metadata = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_template_parts();
     494    if ( $can_use_cached ) {
     495        wp_cache_set( $cache_key, $metadata, $cache_group );
    499496    }
    500497
Note: See TracChangeset for help on using the changeset viewer.