WordPress.org

Make WordPress Core

Ticket #20658: 20658.patch

File 20658.patch, 1.2 KB (added by SergeyBiryukov, 2 years ago)
  • wp-includes/post.php

     
    38233823        $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); 
    38243824        $file = get_attached_file( $post_id ); 
    38253825 
     3826        $intermediate_sizes = array(); 
     3827        foreach ( get_intermediate_image_sizes() as $size ) { 
     3828                if ( $intermediate = image_get_intermediate_size( $post_id, $size ) ) 
     3829                        $intermediate_sizes[] = $intermediate; 
     3830        } 
     3831 
    38263832        if ( is_multisite() ) 
    38273833                delete_transient( 'dirsize_cache' ); 
    38283834 
     
    38573863        } 
    38583864 
    38593865        // remove intermediate and backup images if there are any 
    3860         foreach ( get_intermediate_image_sizes() as $size ) { 
    3861                 if ( $intermediate = image_get_intermediate_size($post_id, $size) ) { 
    3862                         $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); 
    3863                         @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); 
    3864                 } 
     3866        foreach ( $intermediate_sizes as $intermediate ) { 
     3867                $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] ); 
     3868                @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); 
    38653869        } 
    38663870 
    38673871        if ( is_array($backup_sizes) ) {