WordPress.org

Make WordPress Core

Ticket #24518: wp-includes-post.php.patch

File wp-includes-post.php.patch, 1.3 KB (added by JoshuaAbenazer, 11 months ago)

wp_delete_attachment() patch

  • wp-includes/post.php

     
    40634063        $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); 
    40644064        $file = get_attached_file( $post_id ); 
    40654065 
    4066         $intermediate_sizes = array(); 
    4067         foreach ( get_intermediate_image_sizes() as $size ) { 
    4068                 if ( $intermediate = image_get_intermediate_size( $post_id, $size ) ) 
    4069                         $intermediate_sizes[] = $intermediate; 
    4070         } 
    4071  
    40724066        if ( is_multisite() ) 
    40734067                delete_transient( 'dirsize_cache' ); 
    40744068 
     
    41034097        } 
    41044098 
    41054099        // remove intermediate and backup images if there are any 
    4106         foreach ( $intermediate_sizes as $intermediate ) { 
    4107                 $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] ); 
    4108                 @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); 
    4109         } 
     4100        if ( isset($meta['sizes']) && is_array($meta['sizes']) ) { 
     4101                foreach ( $meta['sizes'] as $size => $sizeinfo ) { 
     4102                        $intermediate_file = str_replace(basename($file), $sizeinfo['file'], $file); 
     4103                        $intermediate_file = apply_filters('wp_delete_file', $intermediate_file); 
     4104                        @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); 
     4105                } 
     4106        }        
    41104107 
    41114108        if ( is_array($backup_sizes) ) { 
    41124109                foreach ( $backup_sizes as $size ) {