Filter hook 'async_upload_{$type}'

in WP Core File wp-admin/async-upload.php at line 164

View Source

async_upload_{$type}

Filter Hook
Description
Filters the returned ID of an uploaded attachment. The dynamic portion of the hook name, `$type`, refers to the attachment type. Possible hook names include: - `async_upload_audio` - `async_upload_file` - `async_upload_image` - `async_upload_video`

Hook Information

File Location wp-admin/async-upload.php View on GitHub
Hook Type Filter
Line Number 164

Hook Parameters

Type Name Description
int $id Uploaded attachment ID.

Usage Examples

Basic Usage
<?php
// Hook into async_upload_{$type}
add_filter('async_upload_{$type}', 'my_custom_filter', 10, 1);

function my_custom_filter($id) {
    // Your custom filtering logic here
    return $id;
}

Source Code Context

wp-admin/async-upload.php:164 - How this hook is used in WordPress core
<?php
 159  	 *
 160  	 * @since 2.5.0
 161  	 *
 162  	 * @param int $id Uploaded attachment ID.
 163  	 */
 164  	echo apply_filters( "async_upload_{$type}", $id );
 165  }

PHP Documentation

<?php
/**
	 * Filters the returned ID of an uploaded attachment.
	 *
	 * The dynamic portion of the hook name, `$type`, refers to the attachment type.
	 *
	 * Possible hook names include:
	 *
	 *  - `async_upload_audio`
	 *  - `async_upload_file`
	 *  - `async_upload_image`
	 *  - `async_upload_video`
	 *
	 * @since 2.5.0
	 *
	 * @param int $id Uploaded attachment ID.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/async-upload.php
Related Hooks

Related hooks will be displayed here in future updates.