add_action( 'before_delete_post', 'yazi_ile_one_cikan_gorseli_sil', 10 );
function yazi_ile_one_cikan_gorseli_sil($post_id)
{
if(has_post_thumbnail( $post_id ))
{
$attachment_id = get_post_thumbnail_id( $post_id );
wp_delete_attachment($attachment_id, true);
}
}bunu fonk php ye attım. fakat yazıyı silince öne çıkan görsel ortam dosyalarında hala duruyor. kodda eksik bişeyler mi var acaba
If you're using this hook note that it will
not fire if the user is deleting an Attachment, since attachments are
force deleted, i.e., not sent to the Trash. Instead use the
delete_post() hook.
Wp Codex te sorunuzun cevabı var.