get_attached_media filter-hookWP 3.6.0

Filters the list of media attached to the given post.

Usage

add_filter( 'get_attached_media', 'wp_kama_get_attached_media_filter', 10, 3 );

/**
 * Function for `get_attached_media` filter-hook.
 * 
 * @param WP_Post[] $children Array of media attached to the given post.
 * @param string    $type     Mime type of the media desired.
 * @param WP_Post   $post     Post object.
 *
 * @return WP_Post[]
 */
function wp_kama_get_attached_media_filter( $children, $type, $post ){

	// filter...
	return $children;
}
$children(WP_Post[])
Array of media attached to the given post.
$type(string)
Mime type of the media desired.
$post(WP_Post)
Post object.

Changelog

Since 3.6.0 Introduced.

Where the hook is called

get_attached_media()
get_attached_media
wp-includes/media.php 4987
return (array) apply_filters( 'get_attached_media', $children, $type, $post );

Where the hook is used in WordPress

Usage not found.