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

---

# apply_filters( ‘upload_size_limit’, int $size, int $u_bytes, int $p_bytes )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#user-contributed-notes)

Filters the maximum upload size allowed in php.ini.

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

 `$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.

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

    ```php
    return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
    ```

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

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

| Used by | Description | 
| [wp_max_upload_size()](https://developer.wordpress.org/reference/functions/wp_max_upload_size/)`wp-includes/media.php` |

Determines the maximum upload size allowed in php.ini.

  |

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

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

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#comment-content-16)
 2.    [Drew Jaynes](https://profiles.wordpress.org/drewapicture/)  [  12 years ago  ](https://developer.wordpress.org/reference/hooks/upload_size_limit/#comment-16)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fupload_size_limit%2F%23comment-16)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fupload_size_limit%2F%23comment-16)
 4.      ```php
         /**
          * Filter the upload size limit for non-administrators.
          *
          * @param string $size Upload size limit (in bytes).
          * @return int (maybe) Filtered size limit.
          */
         function filter_site_upload_size_limit( $size ) {
         	// Set the upload size limit to 10 MB for users lacking the 'manage_options' capability.
         	if ( ! current_user_can( 'manage_options' ) ) {
         		// 10 MB.
         		$size = 1024 * 10000;
         	}
         	return $size;
         }
         add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );
         ```
     
 5.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fupload_size_limit%2F%3Freplytocom%3D16%23feedback-editor-16)
 6.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/upload_size_limit/?output_format=md#comment-content-3384)
 7.    [Jake Spurlock](https://profiles.wordpress.org/whyisjake/)  [  7 years ago  ](https://developer.wordpress.org/reference/hooks/upload_size_limit/#comment-3384)
 8.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fupload_size_limit%2F%23comment-3384)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fupload_size_limit%2F%23comment-3384)
 9.  The third parameter is the priority to call the callback function. 10 is the default.
 10.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fupload_size_limit%2F%3Freplytocom%3D3384%23feedback-editor-3384)

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