WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/15/2015 04:27:17 PM (5 years ago)
Author:
obenland
Message:

Properly clean up header image data when the attachment is deleted.

Props CreativeInfusion.
Fixes #33005.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r33240 r33278  
    19321932 *
    19331933 * If true it removes the theme modification which would be pointing at the deleted
    1934  * attachment
     1934 * attachment.
    19351935 *
    19361936 * @access private
    19371937 * @since 3.0.0
    1938  * @param int $id the attachment id
     1938 * @since 4.3.0 Also removes `header_image_data`.
     1939 *
     1940 * @param int $id The attachment id.
    19391941 */
    19401942function _delete_attachment_theme_mod( $id ) {
    19411943    $attachment_image = wp_get_attachment_url( $id );
    1942     $header_image = get_header_image();
     1944    $header_image     = get_header_image();
    19431945    $background_image = get_background_image();
    19441946
    1945     if ( $header_image && $header_image == $attachment_image )
     1947    if ( $header_image && $header_image == $attachment_image ) {
    19461948        remove_theme_mod( 'header_image' );
    1947 
    1948     if ( $background_image && $background_image == $attachment_image )
     1949        remove_theme_mod( 'header_image_data' );
     1950    }
     1951
     1952    if ( $background_image && $background_image == $attachment_image ) {
    19491953        remove_theme_mod( 'background_image' );
     1954    }
    19501955}
    19511956
Note: See TracChangeset for help on using the changeset viewer.