if ( !
current_user_can( 'edit_post',
$post_id ) ) { wp_die( __( 'Sorry, you are not allowed to edit this item.'
) );
} if ( 'trash' ===
$post->post_status
) { wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.'
) );
} if ( !
empty( $_GET['get-post-lock'
] ) ) { check_admin_referer( 'lock-post_' .
$post_id );
wp_set_post_lock( $post_id );
wp_redirect( get_edit_post_link( $post_id, 'url'
) );
exit;
} $post_type =
$post->post_type;
if ( 'post' ===
$post_type ) { $parent_file = 'edit.php';
$submenu_file = 'edit.php';
$post_new_file = 'post-new.php';
} elseif ( 'attachment' ===
$post_type ) { $parent_file = 'upload.php';