WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/20/2015 06:22:41 PM (4 years ago)
Author:
obenland
Message:

Site Icon: Get site icon ID only when needed.

Cuts down on unnecessary queries, especially in environments that rely on
post meta a lot. Reverts [32997].

Props ap.koponen, swissspidy.
Fixes #34368.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-icon.php

    r35271 r35299  
    230230     */
    231231    public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
    232         $site_icon_id = get_option( 'site_icon' );
    233 
    234         if ( $post_id == $site_icon_id && '_wp_attachment_backup_sizes' == $meta_key && $single ) {
    235             add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
     232        if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) {
     233            $site_icon_id = get_option( 'site_icon' );
     234
     235            if ( $post_id == $site_icon_id ) {
     236                add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
     237            }
    236238        }
    237239
Note: See TracChangeset for help on using the changeset viewer.