wp delete attachment unlink

Solutions on MaxInterview for wp delete attachment unlink by the best coders in the world

showing results for - "wp delete attachment unlink"
Josefina
14 Oct 2016
1foreach ( $attachments as $attachment ) {
2  if ( false === wp_delete_attachment( $attachment->ID, true ) ) {
3    $file = get_attached_file( $attachment->ID );
4    $file = str_replace( "uploads", "upload-assets", $file);
5     wp_delete_file( $file );
6   }
7 }
8