Filter hook 'get_attached_media_args'

in WP Core File wp-includes/media.php at line 5179

View Source

get_attached_media_args

Filter Hook
Description
Filters arguments used to retrieve media attached to the given post.

Hook Information

File Location wp-includes/media.php View on GitHub
Hook Type Filter
Line Number 5179

Hook Parameters

Type Name Description
array $args Post query arguments.
string $type Mime type of the desired media.
WP_Post $post Post object.

Usage Examples

Basic Usage
<?php
// Hook into get_attached_media_args
add_filter('get_attached_media_args', 'my_custom_filter', 10, 3);

function my_custom_filter($args, $type, $post) {
    // Your custom filtering logic here
    return $args;
}

Source Code Context

wp-includes/media.php:5179 - How this hook is used in WordPress core
<?php
5174  	 *
5175  	 * @param array   $args Post query arguments.
5176  	 * @param string  $type Mime type of the desired media.
5177  	 * @param WP_Post $post Post object.
5178  	 */
5179  	$args = apply_filters( 'get_attached_media_args', $args, $type, $post );
5180  
5181  	$children = get_children( $args );
5182  
5183  	/**
5184  	 * Filters the list of media attached to the given post.

PHP Documentation

<?php
/**
	 * Filters arguments used to retrieve media attached to the given post.
	 *
	 * @since 3.6.0
	 *
	 * @param array   $args Post query arguments.
	 * @param string  $type Mime type of the desired media.
	 * @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.