Make WordPress Core


Ignore:
Timestamp:
11/11/2022 04:29:27 PM (2 years ago)
Author:
desrosj
Message:

Themes: Reduce usage of wp_get_theme function.

Calling the wp_get_theme function creates a instance of the WP_Theme class. This can be a performance issue, if all you need is one property of the class instance. This change replaces the usage of wp_get_theme()->get_stylesheet() with get_stylesheet() to improve performance.

Props spacedmonkey, flixos90, peterwilsoncc, desrosj.
Merges [54817] to the 6.1 branch.
Fixes #57057.

Location:
branches/6.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.1

  • branches/6.1/src/wp-includes/blocks/template-part.php

    r54812 r54818  
    2323        isset( $attributes['slug'] ) &&
    2424        isset( $attributes['theme'] ) &&
    25         wp_get_theme()->get_stylesheet() === $attributes['theme']
     25        get_stylesheet() === $attributes['theme']
    2626    ) {
    2727        $template_part_id    = $attributes['theme'] . '//' . $attributes['slug'];
Note: See TracChangeset for help on using the changeset viewer.