wp_count_attachments
Filters the attachment counts by mime type.
Usage
add_filter( 'wp_count_attachments', 'wp_kama_count_attachments_filter', 10, 2 );
/**
* Function for `wp_count_attachments` filter-hook.
*
* @param stdClass $counts An object containing the attachment counts by mime type.
* @param string|string[] $mime_type Array or comma-separated list of MIME patterns.
*
* @return stdClass
*/
function wp_kama_count_attachments_filter( $counts, $mime_type ){
// filter...
return $counts;
}
- $counts(stdClass)
- An object containing the attachment counts by mime type.
- $mime_type(string|string[])
- Array or comma-separated list of MIME patterns.
Changelog
| Since 3.7.0 | Introduced. |
Where the hook is called
wp_count_attachments
wp-includes/post.php 3531
return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );