wpseek.com
A WordPress-centric search engine for devs and theme authors
pre_wp_count_attachments › WordPress Filter Hooks
Since7.2.0
Deprecatedn/a
› apply_filters( 'pre_wp_count_attachments', null, $mime_type )
| Parameters: (2) |
|
| Defined at: |
|
| Codex: |
Filters the attachment counts before the query is run.
Returning a stdClass object short-circuits wp_count_attachments(), skipping both the object cache lookup and the database queries. This allows the counts to be served from another source, such as a value pre-computed in the background, when an exact real-time count is not required. If the filtered value does not contain a trash count, one is added to the result and set to zero. Missing MIME types are not added, as they depend on the attachments that exist. The filtered value should therefore contain a count for every MIME type matching `$mime_type` that has attachments, including types first uploaded after the value was computed, as callers may read the count for any MIME type that exists. It should also contain only MIME types matching `$mime_type`, with a trash count limited to attachments of those types, as the default query does. The returned value is not cached and passed through the {@see 'wp_count_attachments'} filter.Related Functions: wp_count_attachments, prepend_attachment, wp_count_comments, wp_insert_attachment, wp_attachment_is, wp_delete_attachment