wp_max_upload_size() WordPress Function
The wp_max_upload_size() function is used to get the maximum upload size for files in WordPress. This function is useful for checking if a file is too large to be uploaded to WordPress.
wp_max_upload_size() #
Determines the maximum upload size allowed in php.ini.
Return
(int) Allowed upload size.
Source
File: wp-includes/media.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 );
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |