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
This commit is contained in:
Andrew Nacin 2012-08-24 15:32:23 +00:00
parent 770ee9720a
commit 7de27aaab7
1 changed files with 5 additions and 3 deletions

View File

@ -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 ) ) {