wp_count_attachments
Filter HookDescription
Filters the attachment counts by mime type.Hook Information
File Location |
wp-includes/post.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3463 |
Hook Parameters
Type | Name | Description |
---|---|---|
stdClass
|
$counts
|
An object containing the attachment counts by mime type. |
string|string[]
|
$mime_type
|
Array or comma-separated list of MIME patterns. |
Usage Examples
Basic Usage
<?php
// Hook into wp_count_attachments
add_filter('wp_count_attachments', 'my_custom_filter', 10, 2);
function my_custom_filter($counts, $mime_type) {
// Your custom filtering logic here
return $counts;
}
Source Code Context
wp-includes/post.php:3463
- How this hook is used in WordPress core
<?php
3458 *
3459 * @param stdClass $counts An object containing the attachment counts by
3460 * mime type.
3461 * @param string|string[] $mime_type Array or comma-separated list of MIME patterns.
3462 */
3463 return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );
3464 }
3465
3466 /**
3467 * Gets default post mime types.
3468 *
PHP Documentation
<?php
/**
* Filters the attachment counts by mime type.
*
* @since 3.7.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.