On this page
wp_max_upload_size(): int
Determines the maximum upload size allowed in php.ini.
Return
int Allowed upload size.
Source
File: wp-includes/media.php. View all references
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 );
}
Hooks
- apply_filters( 'upload_size_limit',
int $size ,int $u_bytes ,int $p_bytes ) -
Filters the maximum upload size allowed in php.ini.
Related
Uses
| Uses | Description |
|---|---|
| wp_convert_hr_to_bytes() wp-includes/load.php | Converts a shorthand byte value to an integer byte value. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| get_default_block_editor_settings() wp-includes/block-editor.php | Returns the default block editor settings. |
| 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() wp-admin/includes/media.php | Outputs the legacy media upload form. |
| wp_plupload_default_settings() wp-includes/media.php | Prints default Plupload arguments. |
| wp_print_media_templates() wp-includes/media-template.php | Prints the templates used in the media manager. |
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_max_upload_size