Browse files

Clean attachment cache after a manual update, not before. props mdawa…

…ffe. fixes #20786.

git-svn-id: http://core.svn.wordpress.org/trunk@21605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 770ee97 commit 7de27aaab728ab131f2f68e85d501f8f00acbecd @nacin nacin committed Aug 24, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 wp-admin/upload.php
View
8 wp-admin/upload.php
@@ -69,12 +69,14 @@
continue;
$attach[] = $att_id;
- clean_attachment_cache( $att_id );
}
if ( ! empty( $attach ) ) {
- $attach = implode( ',', $attach );
- $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach )", $parent_id ) );
+ $attach_string = implode( ',', $attach );
+ $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach_string )", $parent_id ) );
+ foreach ( $attach as $att_id ) {
+ clean_attachment_cache( $att_id );
+ }
}
if ( isset( $attached ) ) {

0 comments on commit 7de27aa

Please sign in to comment.