Function wp_attachment_folder
Returns the folder id of an given attachment or more than one attachment (array). If you pass an array as attachment ids, then the default value does not work, only for single queries. When you pass a shortcut attachment id, the folder id for the shortcut is returned.
Parameters summary
integer |
$attachmentId |
The attachment ID, if you pass an array you get an array of folder IDs |
mixed |
$default = null |
If no folder was found for this, this value is returned for the attachment |