Check that $post_type_object exists before accessing its properties. Props markoheijnen. Fixes #20064.
git-svn-id: https://develop.svn.wordpress.org/trunk@20623 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a49867ae66
commit
858ba1fabd
@ -134,15 +134,15 @@ case 'edit':
|
|||||||
if ( empty($post->ID) )
|
if ( empty($post->ID) )
|
||||||
wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') );
|
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) )
|
if ( !current_user_can($post_type_object->cap->edit_post, $post_id) )
|
||||||
wp_die( __('You are not allowed to edit this item.') );
|
wp_die( __('You are not allowed to edit this item.') );
|
||||||
|
|
||||||
if ( 'trash' == $post->post_status )
|
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.') );
|
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;
|
$post_type = $post->post_type;
|
||||||
if ( 'post' == $post_type ) {
|
if ( 'post' == $post_type ) {
|
||||||
$parent_file = "edit.php";
|
$parent_file = "edit.php";
|
||||||
|
Loading…
Reference in New Issue
Block a user