apply_filters( 'upload_size_limit', int $size , int $u_bytes , int $p_bytes )
Filters the maximum upload size allowed in php.ini.
Description Description
Parameters 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 Source
File: wp-includes/media.php
Changelog Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
/** * 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 );Expand full source codeCollapse full source code
for the sake of precision:
I don’t get the point of ’20’ sent back if not taking in all 3 params?
Feedback
The third parameter is the priority to call the callback function. 10 is the default. — By Jake Spurlock —