Use correct cap check. see #13358.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-05-12 19:39:30 +00:00
parent 3033d58856
commit b2d3b7efa2
1 changed files with 1 additions and 1 deletions

View File

@ -1525,7 +1525,7 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ( 'readable' == $perm && is_user_logged_in() ) {
$post_type_object = get_post_type_object($type);
if ( !current_user_can("read_private_{$post_type_object->capability_type}s") ) {
if ( !current_user_can( $post_type_object->read_private_cap ) ) {
$cache_key .= '_' . $perm . '_' . $user->ID;
$query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))";
}