get_delete_post_link( $post_id); redirects to a 404 page

Hi,

I have created a button to delete posts from the front end with this wordpress code:

get_delete_post_link( $post_id);

My problem is after the deletion I have been redirected to a 404 page: http://redminka.com/47/?trashed=1&ids=47

I have tried to redirect to a home page with this code but not work:

add_action('before_delete_post','my_trashed_post_handler',10,1);
function my_trashed_post_handler($post_id) {
   if( !is_admin()) {
    wp_redirect(get_option('siteurl'));
    exit;
   }
}

What I do wrong?

Best regards