Redirect after delete post in Frontend

I got a little bit more into this topic and found this solution which works perfect for me.

1 Add this code to functions.php:

// Delete post
function delete_post(){
    global $post;
    $deletepostlink= add_query_arg( 'frontend', 'true', get_delete_post_link( get_the_ID() ) );
    if (current_user_can('edit_post', $post->ID)) {
        echo       '<span><a class="post-delete-link" onclick="return confirm(\'¿Are you sure to delete?\')" href="'.$deletepostlink.'">Borrar</a></span>';
    }
}

//Redirect after delete post in frontend
add_action('trashed_post','trash_redirection_frontend');
function trash_redirection_frontend($post_id) {
    if ( filter_input( INPUT_GET, 'frontend', FILTER_VALIDATE_BOOLEAN ) ) {
        wp_redirect( get_option('siteurl').'/page-deleted-post' );
        exit;
    }
}

2 Call the function on youre template file (single.php or whatever):

echo delete_post();