Ticket #24803: 24803.diff
File 24803.diff, 747 bytes (added by , 11 years ago) |
---|
-
wp-includes/post.php
2056 2056 $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; 2057 2057 if ( 'readable' == $perm && is_user_logged_in() ) { 2058 2058 $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 ) ) { 2060 2060 $cache_key .= '_' . $perm . '_' . $user->ID; 2061 2061 $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))"; 2062 2062 }