wp_count_attachments( string|array $mime_type = '' )

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


25 related functions found for: wp_count_attachments

Top ↑

Related terms found for this post

TaxonomyTerms
wp-parser-related-wordsattach, attachment, attachments, count, counts, integ, integer, post-php, post-typ, post-type, wp-count, wp-includes
wp-parser-packagePost, WordPress
wp-parser-source-filewp-includes/post.php

Top ↑

Terms Used Terms Used

Terms used in the related posts query

  • attach
  • attachment
  • attachments
  • count
  • counts
  • integ
  • integer
  • Post
  • post-php
  • post-typ
  • post-type
  • wp-count
  • wp-includes
  • wp-includes/post.php
  • post

Top ↑

Description Description

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.


Top ↑

Parameters Parameters

$mime_type

(string|array) (Optional) Array or comma-separated list of MIME patterns.

Default value: ''


Top ↑

Return Return

(object) An object containing the attachment counts by mime type.


Top ↑

Source Source

File: wp-includes/post.php


			

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.