get_attached_media
Filters the list of media attached to the given post.
Использование
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(строка)
- Mime type of the media desired.
- $post(WP_Post)
- Post object.
Список изменений
С версии 3.6.0 | Введена. |
Где вызывается хук
get_attached_media
wp-includes/media.php 5007
return (array) apply_filters( 'get_attached_media', $children, $type, $post );