upload_size_limit
Filter HookDescription
Filters the maximum upload size allowed in php.ini.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4190 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$size
|
Max upload size limit in bytes. |
int
|
$u_bytes
|
Maximum upload filesize in bytes. |
int
|
$p_bytes
|
Maximum size of POST data in bytes. |
Usage Examples
Basic Usage
<?php
// Hook into upload_size_limit
add_filter('upload_size_limit', 'my_custom_filter', 10, 3);
function my_custom_filter($size, $u_bytes, $p_bytes) {
// Your custom filtering logic here
return $size;
}
Source Code Context
wp-includes/media.php:4190
- How this hook is used in WordPress core
<?php
4185 *
4186 * @param int $size Max upload size limit in bytes.
4187 * @param int $u_bytes Maximum upload filesize in bytes.
4188 * @param int $p_bytes Maximum size of POST data in bytes.
4189 */
4190 return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
4191 }
4192
4193 /**
4194 * Returns a WP_Image_Editor instance and loads file into it.
4195 *
PHP Documentation
<?php
/**
* 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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.