Changeset 25578 for trunk/src/wp-includes/post.php
- Timestamp:
- 09/23/2013 07:07:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r25572 r25578 2110 2110 2111 2111 $counts = wp_cache_get( $cache_key, 'counts' ); 2112 if ( false !== $counts ) { 2113 /** 2114 * Modify returned post counts by status for the current post type. 2115 * 2116 * @since 3.7.0 2117 * 2118 * @param object $counts An object containing the current post_type's post counts by status. 2119 * @param string $type The post type. 2120 * @param string $perm The permission to determine if the posts are 'readable' by the current user. 2121 */ 2122 return apply_filters( 'count_posts', $counts, $type, $perm ); 2123 } 2124 2125 $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); 2126 2127 $counts = array_fill_keys( get_post_stati(), 0 ); 2128 2129 foreach ( $results as $row ) 2130 $counts[ $row['post_status'] ] = $row['num_posts']; 2131 2132 $counts = (object) $counts; 2133 wp_cache_set( $cache_key, $counts, 'counts' ); 2134 2135 //duplicate_hook 2136 return apply_filters( 'count_posts', $counts, $type, $perm ); 2112 if ( false === $counts ) { 2113 $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); 2114 $counts = array_fill_keys( get_post_stati(), 0 ); 2115 2116 foreach ( $results as $row ) 2117 $counts[ $row['post_status'] ] = $row['num_posts']; 2118 2119 $counts = (object) $counts; 2120 wp_cache_set( $cache_key, $counts, 'counts' ); 2121 } 2122 2123 /** 2124 * Modify returned post counts by status for the current post type. 2125 * 2126 * @since 3.7.0 2127 * 2128 * @param object $counts An object containing the current post_type's post counts by status. 2129 * @param string $type The post type. 2130 * @param string $perm The permission to determine if the posts are 'readable' by the current user. 2131 */ 2132 return apply_filters( 'wp_count_posts', $counts, $type, $perm ); 2137 2133 } 2138 2134
Note: See TracChangeset
for help on using the changeset viewer.