WPDev.one
Core Function
View Source on Trac ↗

get_attached_media()

get_attached_media( mixed $type, mixed $post = 0 )

Retrieves media attached to the passed post.

Parameters 2 required

Name / Type Description
$type
string

Mime type.

Required
(int

| WP_Post) $post Optional. Post ID or WP_Post object. Default is global $post.

Required

Return Value

(WP_Post[])
Array of media attached to the given post.

Function Information

Since Version
3.6.0
Source File
wp-includes/media.php
Advertisement