upload_size_limit_filter()WP 3.0.0

Filters the maximum upload file size allowed, in bytes.

No Hooks.

Return

Int. Upload size limit in bytes.

Usage

upload_size_limit_filter( $size );
$size(int) (required)
Upload size limit in bytes.

Changelog

Since 3.0.0 Introduced.

upload_size_limit_filter() code WP 6.1.1

function upload_size_limit_filter( $size ) {
	$fileupload_maxk         = (int) get_site_option( 'fileupload_maxk', 1500 );
	$max_fileupload_in_bytes = KB_IN_BYTES * $fileupload_maxk;

	if ( get_site_option( 'upload_space_check_disabled' ) ) {
		return min( $size, $max_fileupload_in_bytes );
	}

	return min( $size, $max_fileupload_in_bytes, get_upload_space_available() );
}