Title: upload_size_limit_filter
Published: April 25, 2014
Last modified: August 20, 2026

---

# upload_size_limit_filter( int $size ): int

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#changelog)

Filters the maximum upload file size allowed, in bytes.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#parameters)󠁿

 `$size`intrequired

Upload size limit in bytes.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#return)󠁿

 int Upload size limit in bytes.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#source)󠁿

    ```php
    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() );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/ms-functions.php#L2702)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/ms-functions.php#L2702-L2711)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#related)󠁿

| Uses | Description | 
| [get_upload_space_available()](https://developer.wordpress.org/reference/functions/get_upload_space_available/)`wp-includes/ms-functions.php` |

Determines if there is any upload space left in the current blog’s quota.

  | 
| [get_site_option()](https://developer.wordpress.org/reference/functions/get_site_option/)`wp-includes/option.php` |

Retrieve an option value for the current network based on name of option.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/upload_size_limit_filter/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fupload_size_limit_filter%2F)
before being able to contribute a note or feedback.