id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 47868,"wp_delete_attachment returning successfully, deleting all DB data, but NOT deleting files, and NOT returning false",Jossnaz,,"from https://wordpress.stackexchange.com/questions/344976/wp-delete-attachment-returning-successfully-deleting-all-db-data-but-not-delet?noredirect=1#comment505976_344976 I digged into wp_delete_attachment here https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-includes/post.php#L5450 , it calls wp_delete_attachment_files wp_delete_attachment_files returns false on failure, but this is ignored! in wp_delete_attachment. Now I'm not gonna go on a rant how bad that 'design' is. My question is, how can I make sure that the files DO get deleted? I'm calling {{{ $attachments = get_attached_media('', $post->ID); foreach ($attachments as $attachment) { wp_delete_attachment($attachment->ID, true); wp_delete_attachment never returns falsy. }}} How can I figure out and fix wp_delete_attachment ? in my case it seems that some post_meta might be damaged, as the file location sometimes can be lost for some reason. This should return false or better throw and error",defect (bug),new,normal,Awaiting Review,Media,,normal,,has-patch dev-feedback,,