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.


Built from https://develop.svn.wordpress.org/trunk@35299


git-svn-id: http://core.svn.wordpress.org/trunk@35265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2015-10-20 18:23:44 +00:00
parent 0ea90a9174
commit f6941fddf4
2 changed files with 6 additions and 4 deletions

View File

@ -229,10 +229,12 @@ class WP_Site_Icon {
* @return array|null|string The attachment metadata value, array of values, or null.
*/
public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
$site_icon_id = get_option( 'site_icon' );
if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) {
$site_icon_id = get_option( 'site_icon' );
if ( $post_id == $site_icon_id && '_wp_attachment_backup_sizes' == $meta_key && $single ) {
add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
if ( $post_id == $site_icon_id ) {
add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
}
}
return $value;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-35298';
$wp_version = '4.4-alpha-35299';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.