async_upload_<type>

Filters the returned ID of an uploaded attachment.

Description

apply_filters( 'async_upload_<type>', (int) $id ); 

The dynamic portion(s) of the hook name refer to the attachment type, such as image,, audio, video, file, etc.

Parameters (1)

0. $id (int)
Uploaded attachment ID.

Usage

To run the hook, copy the example below.
  1. $id = apply_filters( 'async_upload_{$type}', $id ); 
  2.  
  3. if ( !empty( $id ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the async_upload_<type> callback 
  2. function filter_async_upload_type( $id ) { 
  3. // make filter magic happen here... 
  4. return $id
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "async_upload_{$type}", 'filter_async_upload_type', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "async_upload_{$type}", 'filter_async_upload_type', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

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