upload_size_limit filter-hookWP 2.5.0

Filters the maximum upload size allowed in php.ini.

Usage

add_filter( 'upload_size_limit', 'wp_kama_upload_size_limit_filter', 10, 3 );

/**
 * Function for `upload_size_limit` filter-hook.
 * 
 * @param int $size    Max upload size limit in bytes.
 * @param int $u_bytes Maximum upload filesize in bytes.
 * @param int $p_bytes Maximum size of POST data in bytes.
 *
 * @return int
 */
function wp_kama_upload_size_limit_filter( $size, $u_bytes, $p_bytes ){

	// filter...
	return $size;
}
$size(int)
Max upload size limit in bytes.
$u_bytes(int)
Maximum upload filesize in bytes.
$p_bytes(int)
Maximum size of POST data in bytes.

Changelog

Since 2.5.0 Introduced.

Where the hook is called

wp_max_upload_size()
upload_size_limit
wp-includes/media.php 4014
return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );

Where the hook is used in WordPress

wp-includes/ms-default-filters.php 103
add_filter( 'upload_size_limit', 'upload_size_limit_filter' );