📅  最后修改于: 2022-03-11 14:53:58.199000             🧑  作者: Mango
foreach ( $attachments as $attachment ) {
if ( false === wp_delete_attachment( $attachment->ID, true ) ) {
$file = get_attached_file( $attachment->ID );
$file = str_replace( "uploads", "upload-assets", $file);
wp_delete_file( $file );
}
}