Ticket #35603: 35603.diff
| File 35603.diff, 1.0 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/post.php
2204 2204 function wp_count_posts( $type = 'post', $perm = '' ) { 2205 2205 global $wpdb; 2206 2206 2207 if ( ! post_type_exists( $type ) )2207 if ( ! post_type_exists( $type ) && ( ! is_multisite() || empty( $GLOBALS['_wp_switched_stack'] ) ) ) 2208 2208 return new stdClass; 2209 2209 2210 2210 $cache_key = _count_posts_cache_key( $type, $perm ); … … 2218 2218 $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; 2219 2219 if ( 'readable' == $perm && is_user_logged_in() ) { 2220 2220 $post_type_object = get_post_type_object($type); 2221 if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) {2221 if ( ! $post_type_object || ! current_user_can( $post_type_object->cap->read_private_posts ) ) { 2222 2222 $query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", 2223 2223 get_current_user_id() 2224 2224 );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)