static function add_actions() { add_action('delete_post', function ($post_id) { $post = get_post($post_id); $image_types = array('image/jpeg', 'image/png', 'image/gif', 'image/jpg'); if ($post->post_type == 'attachment' && in_array($post->post_mime_type, $image_types)) { TimberImageHelper::delete_resized_files_from_url($post->guid); TimberImageHelper::delete_letterboxed_files_from_url($post->guid); } }); }