Make WordPress Core


Ignore:
Timestamp:
10/20/2015 06:22:41 PM (9 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/tests/phpunit/tests/image/site_icon.php

    r33335 r35299  
    128128    }
    129129
     130    /**
     131     * @ticket 34368
     132     */
     133    function test_get_post_metadata() {
     134        $attachment_id = $this->_insert_attachment();
     135        update_option( 'site_icon', $attachment_id );
     136
     137        $this->wp_site_icon->get_post_metadata( '', $attachment_id, '_some_post_meta', true );
     138        $this->assertFalse( has_filter( 'intermediate_image_sizes', array( $this->wp_site_icon, 'intermediate_image_sizes' ) ) );
     139
     140        $this->wp_site_icon->get_post_metadata( '', $attachment_id, '_wp_attachment_backup_sizes', true );
     141        $this->assertSame( 10,  has_filter( 'intermediate_image_sizes', array( $this->wp_site_icon, 'intermediate_image_sizes' ) ) );
     142
     143        wp_delete_attachment( $attachment_id, true );
     144    }
     145
    130146    function _custom_test_sizes( $sizes ) {
    131147        $sizes[] = 321;
Note: See TracChangeset for help on using the changeset viewer.