Kode Cara Menghapus Thumbnails Featured Image WordPress

 Masuk ke functions.php lalu kasihkan kode dibawah ini dibawahnya:

/*------------------------------------------------------------------*/
/* Menghapus Featured Images
/*------------------------------------------------------------------*/
 global $wpdb;
 $attachments = $wpdb->get_results( "
 SELECT *
 FROM $wpdb->postmeta
 WHERE meta_key = '_thumbnail_id'
 " );
 foreach ( $attachments as $attachment ) {
 wp_delete_attachment( $attachment->meta_value, true );
 }
 $wpdb->query( "
 DELETE FROM $wpdb->postmeta
 WHERE meta_key = '_thumbnail_id'
 " );
 

lalu refresh atau pergi ke halaman postingan. ketika load, maka itu ketika thumnail sedang proses dihapus.

0 Response to "Kode Cara Menghapus Thumbnails Featured Image WordPress"

Posting Komentar