WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On the reference page for wp_get_attachment_image_src, there is a parameter called icon and it only says:

$icon - (bool) (optional) Use a media icon to represent the attachment. 
Default: false

What is this used for and how does it affect the returned value?

share|improve this question
up vote 1 down vote accepted

It's a icon with which to display the attachment. If it isn't set, it uses the default icon. The exception here is for images: the returned values always refer to the thumbnail (of size set in the arguments of wp_get_attachment_image_src). Icons are always shown at their original size.

If the attachment was an audio file, it would use the audio icon, unless otherwise specified using the icon argument. See the 'Change Icon Directory' section of the link you gave in the question.

share|improve this answer
Upvoted, with a minor clarification: I think that the default behavior is to display the image thumbnail, not an icon. The $icon parameter is used to display a mime-type icon in place of the actual image thumbnail. See the function definition in source. – Chip Bennett Jan 27 '12 at 16:39
Yep, but I think it always uses a thumbnail for images rather than an icon, right? - since image_downsize would return something. – Stephen Harris Jan 27 '12 at 17:29
Right; it appears the mime-type icon only appears for non-images. – Chip Bennett Jan 27 '12 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.