Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 5302ae4

Browse files
committed
Remove existing thumbnail after retranscoding
1 parent dbf90c5 commit 5302ae4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

admin/rt-retranscode-admin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,10 @@ public function transcoded_thumbnails_added( $media_id = '' ) {
849849
wp_update_attachment_metadata( $media_id, $attach_data );
850850
} else {
851851
// Insert transcoded thumbnail attachment for video/audio files.
852+
$existing_thumbnail = get_post_thumbnail_id( $media_id );
853+
if ( ! empty( $existing_thumbnail ) ) {
854+
wp_delete_attachment( $existing_thumbnail, true );
855+
}
852856
$attachment_id = wp_insert_attachment( $attachment, $thumbnail_src, $media_id );
853857
}
854858

0 commit comments

Comments
 (0)