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:
parent
4ab52670e9
commit
eb3e9e6dc7
|
@ -45,6 +45,8 @@ case 'edit':
|
||||||
$page_ID = $post_ID = $p = (int) $_GET['post'];
|
$page_ID = $post_ID = $p = (int) $_GET['post'];
|
||||||
$post = get_post_to_edit($page_ID);
|
$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 ) {
|
if ( 'post' == $post->post_type ) {
|
||||||
wp_redirect("post.php?action=edit&post=$post_ID");
|
wp_redirect("post.php?action=edit&post=$post_ID");
|
||||||
exit();
|
exit();
|
||||||
|
|
|
@ -48,6 +48,8 @@ case 'edit':
|
||||||
$post_ID = $p = (int) $_GET['post'];
|
$post_ID = $p = (int) $_GET['post'];
|
||||||
$post = get_post($post_ID);
|
$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 ) {
|
if ( 'page' == $post->post_type ) {
|
||||||
wp_redirect("page.php?action=edit&post=$post_ID");
|
wp_redirect("page.php?action=edit&post=$post_ID");
|
||||||
exit();
|
exit();
|
||||||
|
|
Loading…
Reference in New Issue