From 5889755c66d8578cce4c8a062e7838333bb5557c Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 20 Apr 2008 21:26:10 +0000 Subject: [PATCH] Don't include perm as part of cache key if perm is not used in the query. git-svn-id: http://svn.automattic.com/wordpress/trunk@7752 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 1fe9da464d..bf3e4e835d 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -827,13 +827,11 @@ function wp_count_posts( $type = 'post', $perm = '' ) { $user = wp_get_current_user(); $cache_key = $type; - if ( !empty($perm) ) - $cache_key .= '_' . $perm; $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; if ( 'readable' == $perm && is_user_logged_in() ) { if ( !current_user_can("read_private_{$type}s") ) { - $cache_key .= '_' . $user->ID; + $cache_key .= '_' . $perm . '_' . $user->ID; $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))"; } }