Filter hook 'attachment_thumbnail_args'

in WP Core File wp-admin/includes/image.php at line 660

View Source

attachment_thumbnail_args

Filter Hook
Description
Filters the parameters for the attachment thumbnail creation. }

Hook Information

File Location wp-admin/includes/image.php View on GitHub
Hook Type Filter
Line Number 660

Hook Parameters

Type Name Description
array $image_attachment An array of parameters to create the thumbnail.
array $metadata Current attachment metadata.
array $uploaded { Information about the newly-uploaded file.

Usage Examples

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

function my_custom_filter($image_attachment, $metadata, $uploaded) {
    // Your custom filtering logic here
    return $image_attachment;
}

Source Code Context

wp-admin/includes/image.php:660 - How this hook is used in WordPress core
<?php
 655  				 *     @type string $file  Filename of the newly-uploaded file.
 656  				 *     @type string $url   URL of the uploaded file.
 657  				 *     @type string $type  File type.
 658  				 * }
 659  				 */
 660  				$image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded );
 661  
 662  				$sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] );
 663  				add_post_meta( $sub_attachment_id, '_cover_hash', $hash );
 664  				$attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] );
 665  				wp_update_attachment_metadata( $sub_attachment_id, $attach_data );

PHP Documentation

<?php
/**
				 * Filters the parameters for the attachment thumbnail creation.
				 *
				 * @since 3.9.0
				 *
				 * @param array $image_attachment An array of parameters to create the thumbnail.
				 * @param array $metadata         Current attachment metadata.
				 * @param array $uploaded         {
				 *     Information about the newly-uploaded file.
				 *
				 *     @type string $file  Filename of the newly-uploaded file.
				 *     @type string $url   URL of the uploaded file.
				 *     @type string $type  File type.
				 * }
				 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-admin/includes/image.php
Related Hooks

Related hooks will be displayed here in future updates.