Make WordPress Core

Changeset 20623


Ignore:
Timestamp:
04/27/2012 07:32:32 PM (13 years ago)
Author:
duck_
Message:

Check that $post_type_object exists before accessing its properties. Props markoheijnen. Fixes #20064.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post.php

    r19712 r20623  
    135135        wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') );
    136136
     137    if ( null == $post_type_object )
     138        wp_die( __('Unknown post type.') );
     139
    137140    if ( !current_user_can($post_type_object->cap->edit_post, $post_id) )
    138141        wp_die( __('You are not allowed to edit this item.') );
     
    140143    if ( 'trash' == $post->post_status )
    141144        wp_die( __('You can’t edit this item because it is in the Trash. Please restore it and try again.') );
    142 
    143     if ( null == $post_type_object )
    144         wp_die( __('Unknown post type.') );
    145145
    146146    $post_type = $post->post_type;
Note: See TracChangeset for help on using the changeset viewer.