Make WordPress Core


Ignore:
Timestamp:
11/11/2022 04:24:47 PM (2 years ago)
Author:
spacedmonkey
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.
Fixes #57057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php

    r54356 r54817  
    529529            $changes->post_status = 'publish';
    530530            $changes->tax_input   = array(
    531                 'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : wp_get_theme()->get_stylesheet(),
     531                'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : get_stylesheet(),
    532532            );
    533533        } elseif ( 'custom' !== $template->source ) {
Note: See TracChangeset for help on using the changeset viewer.