Use correct cap check. see #13358.
git-svn-id: https://develop.svn.wordpress.org/trunk@14584 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6f8142acd3
commit
4b6c5c65c6
@ -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' ))";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user