get_attached_media
Filter HookDescription
Filters the list of media attached to the given post.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 5192 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Post[]
|
$children
|
Array of media attached to the given post. |
string
|
$type
|
Mime type of the media desired. |
WP_Post
|
$post
|
Post object. |
Usage Examples
Basic Usage
<?php
// Hook into get_attached_media
add_filter('get_attached_media', 'my_custom_filter', 10, 3);
function my_custom_filter($children, $type, $post) {
// Your custom filtering logic here
return $children;
}
Source Code Context
wp-includes/media.php:5192
- How this hook is used in WordPress core
<?php
5187 *
5188 * @param WP_Post[] $children Array of media attached to the given post.
5189 * @param string $type Mime type of the media desired.
5190 * @param WP_Post $post Post object.
5191 */
5192 return (array) apply_filters( 'get_attached_media', $children, $type, $post );
5193 }
5194
5195 /**
5196 * Checks the HTML content for an audio, video, object, embed, or iframe tags.
5197 *
PHP Documentation
<?php
/**
* Filters the list of media attached to the given post.
*
* @since 3.6.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.