Ticket #20786: 20786.diff

File 20786.diff, 859 bytes (added by mdawaffe, 12 months ago)
  • wp-admin/upload.php

     
    6969                                        continue; 
    7070 
    7171                                $attach[] = $att_id; 
    72                                 clean_attachment_cache( $att_id ); 
    7372                        } 
    7473 
    7574                        if ( ! empty( $attach ) ) { 
    76                                 $attach = implode( ',', $attach ); 
    77                                 $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach )", $parent_id ) ); 
     75                                $attach_string = implode( ',', $attach ); 
     76                                $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach_string )", $parent_id ) ); 
     77                                foreach ( $attach as $att_id ) { 
     78                                        clean_attachment_cache( $att_id ); 
     79                                } 
    7880                        } 
    7981 
    8082                        if ( isset( $attached ) ) {