Make WordPress Core

Changeset 21605


Ignore:
Timestamp:
08/24/2012 03:32:23 PM (12 years ago)
Author:
nacin
Message:

Clean attachment cache after a manual update, not before. props mdawaffe. fixes #20786.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upload.php

    r21597 r21605  
    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
Note: See TracChangeset for help on using the changeset viewer.