async_upload_file filter-hookWP 2.5.0

Filters the returned ID of an uploaded attachment.

This is one of the variants of the dynamic hook async_upload_(type)

Usage

add_filter( 'async_upload_file', 'wp_kama_async_upload_file_filter' );

/**
 * Function for `async_upload_file` filter-hook.
 * 
 * @param int $id Uploaded attachment ID.
 *
 * @return int
 */
function wp_kama_async_upload_file_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_file
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 33
add_filter( 'async_upload_file', 'get_media_item', 10, 2 );