Title: wp_max_upload_size
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_max_upload_size(): int

## In this article

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

[ Back to top](https://developer.wordpress.org/reference/functions/wp_max_upload_size/?output_format=md#wp--skip-link--target)

Determines the maximum upload size allowed in php.ini.

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

 int Allowed upload size.

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

    ```php
    function wp_max_upload_size() {
    	$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
    	$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );

    	/**
    	 * Filters the maximum upload size allowed in php.ini.
    	 *
    	 * @since 2.5.0
    	 *
    	 * @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 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/6.9.4/src/wp-includes/media.php#L4189)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/media.php#L4189-L4203)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_max_upload_size/?output_format=md#hooks)󠁿

 [apply_filters( ‘upload_size_limit’, int $size, int $u_bytes, int $p_bytes )](https://developer.wordpress.org/reference/hooks/upload_size_limit/)

Filters the maximum upload size allowed in php.ini.

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

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

Converts a shorthand byte value to an integer byte value.

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

Calls the callback functions that have been added to a filter hook.

  |

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

Returns the default block editor settings.

  | 
| [wp_import_upload_form()](https://developer.wordpress.org/reference/functions/wp_import_upload_form/)`wp-admin/includes/template.php` |

Outputs the form used by the importers to accept the data to be imported.

  | 
| [media_upload_form()](https://developer.wordpress.org/reference/functions/media_upload_form/)`wp-admin/includes/media.php` |

Outputs the legacy media upload form.

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

Prints default Plupload arguments.

  | 
| [wp_print_media_templates()](https://developer.wordpress.org/reference/functions/wp_print_media_templates/)`wp-includes/media-template.php` |

Prints the templates used in the media manager.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_max_upload_size/?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/functions/wp_max_upload_size/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/wp_max_upload_size/?output_format=md#comment-content-1619)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_max_upload_size/#comment-1619)
 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%2Ffunctions%2Fwp_max_upload_size%2F%23comment-1619)
    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%2Ffunctions%2Fwp_max_upload_size%2F%23comment-1619)
 4. **Get maximum upload size (in bytes)**
 5.     ```php
        $max_upload_size = wp_max_upload_size(); // Returns integer number.
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_max_upload_size%2F%3Freplytocom%3D1619%23feedback-editor-1619)

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