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

git-svn-id: https://develop.svn.wordpress.org/trunk@21605 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-08-24 15:32:23 +00:00
parent e1d2b7baa0
commit 5a9dd669a2

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