Display error message when attempting to edit post or page IDs that do not exist. Props Viper007Bond. fixes #4737

git-svn-id: http://svn.automattic.com/wordpress/trunk@5875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-08-15 22:31:19 +00:00
parent 4ab52670e9
commit eb3e9e6dc7
2 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,8 @@ case 'edit':
$page_ID = $post_ID = $p = (int) $_GET['post'];
$post = get_post_to_edit($page_ID);
if ( empty($post->ID) ) wp_die( __("You attempted to edit a page that doesn't exist. Perhaps it was deleted?") );
if ( 'post' == $post->post_type ) {
wp_redirect("post.php?action=edit&post=$post_ID");
exit();

View File

@ -48,6 +48,8 @@ case 'edit':
$post_ID = $p = (int) $_GET['post'];
$post = get_post($post_ID);
if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") );
if ( 'page' == $post->post_type ) {
wp_redirect("page.php?action=edit&post=$post_ID");
exit();