Get from the dashboard the ID of the current post being edited

Here’s a simple example that redirects to the edit posts screen. Since what you’re asking for is how to get the post, I’m not bothering with messages or particular redirect pages or other variables – though note that wp_die() will just kill the page. In my tests, it just gets you a blank one.

Anyway, I think the two things you need are the load-(page) hook and the ID from the $_GET variable when editing posts:

add_action( 'load-post.php', 'redirect_post_x' ) ;

function redirect_post_x() {

    //if post ID = 99999: ID not cast as int here
    if ( $_GET[ 'post' ] === '99999' ) {

        wp_redirect( admin_url( 'edit.php' ) );
        exit;

    }

}