From 3f3fe5a7ed6473e995f9b96ee4bcf36fe4c71a35 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Tue, 16 Feb 2016 22:12:27 +0000 Subject: [PATCH] Themes: Use the attachment ID as the key in `get_uploaded_header_images()`. Prevents missing header images when an image has the same name as another header image. Props sirbrillig. Fixes #31786. Built from https://develop.svn.wordpress.org/trunk@36539 git-svn-id: http://core.svn.wordpress.org/trunk@36506 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/custom-header.php | 2 +- wp-includes/theme.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 0955420961..1a8fc32311 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -977,7 +977,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> * @param mixed $choice Which header image to select. Allows for values of 'random-default-image', * for randomly cycling among the default images; 'random-uploaded-image', for randomly cycling * among the uploaded images; the key of a default image registered for that theme; and - * the key of an image uploaded for that theme (the basename of the URL). + * the key of an image uploaded for that theme (the attachment ID of the image). * Or an array of arguments: attachment_id, url, width, height. All are required. */ final public function set_header_image( $choice ) { diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 43334865c2..1727a17711 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1207,7 +1207,7 @@ function get_uploaded_header_images() { foreach ( (array) $headers as $header ) { $url = esc_url_raw( wp_get_attachment_url( $header->ID ) ); $header_data = wp_get_attachment_metadata( $header->ID ); - $header_index = basename($url); + $header_index = $header->ID; $header_images[$header_index] = array(); $header_images[$header_index]['attachment_id'] = $header->ID; diff --git a/wp-includes/version.php b/wp-includes/version.php index 3d0572b21f..4491501f11 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36538'; +$wp_version = '4.5-alpha-36539'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.