From a442d476fe64d11047563e4e207966238576efbb Mon Sep 17 00:00:00 2001 From: duck_ Date: Fri, 27 Apr 2012 19:32:32 +0000 Subject: [PATCH] Check that $post_type_object exists before accessing its properties. Props markoheijnen. Fixes #20064. git-svn-id: http://svn.automattic.com/wordpress/trunk@20623 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/post.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/post.php b/wp-admin/post.php index e1119ce644..035a185540 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -134,15 +134,15 @@ case 'edit': if ( empty($post->ID) ) wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); + if ( null == $post_type_object ) + wp_die( __('Unknown post type.') ); + if ( !current_user_can($post_type_object->cap->edit_post, $post_id) ) wp_die( __('You are not allowed to edit this item.') ); if ( 'trash' == $post->post_status ) wp_die( __('You can’t edit this item because it is in the Trash. Please restore it and try again.') ); - if ( null == $post_type_object ) - wp_die( __('Unknown post type.') ); - $post_type = $post->post_type; if ( 'post' == $post_type ) { $parent_file = "edit.php";