async_upload_(type) filter-hookWP 2.5.0

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:

Usage

add_filter( 'async_upload_(type)', 'wp_kama_async_upload_type_filter' );

/**
 * Function for `async_upload_(type)` filter-hook.
 * 
 * @param int $id Uploaded attachment ID.
 *
 * @return int
 */
function wp_kama_async_upload_type_filter( $id ){

	// filter...
	return $id;
}
$id(int)
Uploaded attachment ID.

Changelog

Since 2.5.0 Introduced.

Where the hook is called

In file: /wp-admin/async-upload.php
async_upload_(type)
wp-admin/async-upload.php 162
echo apply_filters( "async_upload_{$type}", $id );

Where the hook is used in WordPress

wp-admin/includes/admin-filters.php 30
add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
wp-admin/includes/admin-filters.php 31
add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
wp-admin/includes/admin-filters.php 32
add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
wp-admin/includes/admin-filters.php 33
add_filter( 'async_upload_file', 'get_media_item', 10, 2 );