wp_upload_bits

Filters whether to treat the upload bits as an error.

Description

apply_filters( 'wp_upload_bits', (callback) $array ); 

Passing a non-array to the filter will effectively short-circuit preparing the upload bits, returning that value instead.

Parameters (1)

0. $array — Optional. (callback) => array( 'name' => $name, 'bits' => $bits, 'time' => $time )
An array of upload bits data, or a non-array error to return.

Usage

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

Defined (2)

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

/wp-includes/functions.php  
  1. $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) ); 
/wp-includes/ms-default-filters.php  
  1. add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );