wp_count_attachments


wp_count_attachments ( $mime_type = '' )

Parameters:
  • (string|array) $mime_type Optional. Array or comma-separated list of MIME patterns. Default empty.
Returns:
  • (object) An object containing the attachment counts by mime type.
Defined at:

Description

Count number of attachments for the mime type(s).

If you set the optional mime_type parameter, then an array will still be returned, but will only have the item you are looking for. It does not give you the number of attachments that are children of a post. You can get that by counting the number of children that post has.

Related Functions

wp_count_comments, wp_insert_attachment, wp_attachment_is, wp_delete_attachment, wp_get_attachment_url

Top Google Results

User discussions

wpseek mobile