Properly clean up header image data when the attachment is deleted.
Props CreativeInfusion. Fixes #33005. Built from https://develop.svn.wordpress.org/trunk@33278 git-svn-id: http://core.svn.wordpress.org/trunk@33250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f28b182a7c
commit
080a4adfba
|
@ -1931,22 +1931,27 @@ function require_if_theme_supports( $feature, $include ) {
|
|||
* Checks an attachment being deleted to see if it's a header or background image.
|
||||
*
|
||||
* If true it removes the theme modification which would be pointing at the deleted
|
||||
* attachment
|
||||
* attachment.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.0
|
||||
* @param int $id the attachment id
|
||||
* @since 4.3.0 Also removes `header_image_data`.
|
||||
*
|
||||
* @param int $id The attachment id.
|
||||
*/
|
||||
function _delete_attachment_theme_mod( $id ) {
|
||||
$attachment_image = wp_get_attachment_url( $id );
|
||||
$header_image = get_header_image();
|
||||
$background_image = get_background_image();
|
||||
|
||||
if ( $header_image && $header_image == $attachment_image )
|
||||
if ( $header_image && $header_image == $attachment_image ) {
|
||||
remove_theme_mod( 'header_image' );
|
||||
remove_theme_mod( 'header_image_data' );
|
||||
}
|
||||
|
||||
if ( $background_image && $background_image == $attachment_image )
|
||||
if ( $background_image && $background_image == $attachment_image ) {
|
||||
remove_theme_mod( 'background_image' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-beta2-33276';
|
||||
$wp_version = '4.3-beta2-33278';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue