Make WordPress Core

Ticket #24803: 24803.diff

File 24803.diff, 747 bytes (added by creativeinfusion, 11 years ago)
  • wp-includes/post.php

     
    20562056        $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
    20572057        if ( 'readable' == $perm && is_user_logged_in() ) {
    20582058                $post_type_object = get_post_type_object($type);
    2059                 if ( !current_user_can( $post_type_object->cap->read_private_posts ) ) {
     2059                if ( $post_type_object && !current_user_can( $post_type_object->cap->read_private_posts ) ) {
    20602060                        $cache_key .= '_' . $perm . '_' . $user->ID;
    20612061                        $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))";
    20622062                }