upload_size_limit

The WordPress Core upload size limit hook.

Description

add_filter( 'upload_size_limit', (string) $upload_size_limit_filter ); 

Parameters (1)

0. $upload_size_limit_filter (string) => 'upload_size_limit_filter'
The upload size limit filter.

Usage

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

Defined (2)

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

/wp-includes/ms-default-filters.php  
  1. add_filter( 'upload_size_limit', 'upload_size_limit_filter' ); 
/wp-includes/media.php  
  1. return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );