Remove intermediate images when deleting an attachment. Props tellyworth. fixes #6142
git-svn-id: http://svn.automattic.com/wordpress/trunk@7271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -2180,6 +2180,15 @@ function wp_delete_attachment($postid) {
|
||||
}
|
||||
}
|
||||
|
||||
// remove intermediate images if there are any
|
||||
$sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium'));
|
||||
foreach ( $sizes as $size ) {
|
||||
if ( $intermediate = image_get_intermediate_size($postid, $size) ) {
|
||||
$intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
|
||||
@ unlink($intermediate_file);
|
||||
}
|
||||
}
|
||||
|
||||
$file = apply_filters('wp_delete_file', $file);
|
||||
|
||||
if ( ! empty($file) )
|
||||
|
||||
Reference in New Issue
Block a user