From 7de27aaab728ab131f2f68e85d501f8f00acbecd Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 24 Aug 2012 15:32:23 +0000 Subject: [PATCH] Clean attachment cache after a manual update, not before. props mdawaffe. fixes #20786. git-svn-id: http://core.svn.wordpress.org/trunk@21605 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/upload.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 997d4b94f8..7d50d5290d 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -69,12 +69,14 @@ if ( $doaction ) { 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 ) ) {