Make WordPress Core

Ticket #28135: 28135.diff

File 28135.diff, 1.1 KB (added by jesin, 11 years ago)

Checks if $post_type_object is empty or not

  • wp-includes/ms-blogs.php

     
    874874 */
    875875function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
    876876        $post_type_obj = get_post_type_object( $post->post_type );
    877         if ( ! $post_type_obj->public )
     877        if ( empty( $post_type_obj ) || ! $post_type_obj->public )
    878878                return;
    879879
    880880        if ( 'publish' != $new_status && 'publish' != $old_status )
  • wp-includes/post.php

     
    23142314        $cache_key = 'posts-' . $type;
    23152315        if ( 'readable' == $perm && is_user_logged_in() ) {
    23162316                $post_type_object = get_post_type_object( $type );
    2317                 if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
     2317                if ( ! empty( $post_type_object ) && ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
    23182318                        $cache_key .= '_' . $perm . '_' . get_current_user_id();
    23192319                }
    23202320        }