wp_count_attachments
Filters the attachment counts by mime type.
Использование
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[])
- Array or comma-separated list of MIME patterns.
Список изменений
| С версии 3.7.0 | Введена. |
Где вызывается хук
wp_count_attachments
wp-includes/post.php 3531
return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );