Changeset 25579
- Timestamp:
- 09/23/2013 07:10:53 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r25578 r25579 2152 2152 $count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A ); 2153 2153 2154 $ stats = array();2154 $counts = array(); 2155 2155 foreach( (array) $count as $row ) { 2156 $stats[$row['post_mime_type']] = $row['num_posts']; 2157 } 2158 $stats['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and"); 2159 2160 return (object) $stats; 2156 $counts[ $row['post_mime_type'] ] = $row['num_posts']; 2157 } 2158 $counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and"); 2159 2160 /** 2161 * Modify returned attachment counts by mime type. 2162 * 2163 * @since 3.7.0 2164 * 2165 * @param object $counts An object containing the attachment counts by mime type. 2166 * @param string $mime_type The mime type pattern used to filter the attachments counted. 2167 */ 2168 return apply_filters( 'wp_count_attachments', (object) $stats, $mime_type ); 2161 2169 } 2162 2170
Note: See TracChangeset
for help on using the changeset viewer.