How to hook a function only when I need to delete permanently a post?

before_delete_post is not called when a post is only trashed.

While wp_delete_post() can trash posts (if the post is not trashed and its not being forcibly deleted): it does so by calling wp_trash_post() and exiting the function prior to the triggering the action before_delete_post.

I’ve tested this, the following function will only ‘die’ when you permanently delete a post, but not when its confined to the trash. The wp_die is to demonstrate when the call is being made – I do not recommend using it on a live site.

add_action('before_delete_post', 'my_deleted_post');
function my_deleted_post($post_id){
   wp_die(var_dump($post_id));
};

The wp_delete_post() function can be found here (WP 3.3.1)