WordPress filter hook · part of WordPress core
upload_size_limit
A WordPress core filter that 4 plugins also fire themselves, running on 40K+ sites between them.
How to use upload_size_limit
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'upload_size_limit', function( $max_filesize_int, $max_filesize_int2, $max_filesize_int3 ) {
// Change $max_filesize_int here.
return $max_filesize_int;
}, 10, 3 );Argument names come from Total Upkeep's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
4 plugins that fire upload_size_limit
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Total Upkeep40,000+ installs
apply_filters( 'upload_size_limit', $max_filesize_int, $max_filesize_int, $max_filesize_int )admin/class-boldgrid-backup-admin-utility.php:563 -
MailBard Newsletters10+ installs
apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes )legacy/helpers/numbers.php:64 -
AutoCraft PlayerFewer than 10 installs
apply_filters( 'upload_size_limit', $maxUploadSize )app/Services/Helper.php:115 -
Poterie Navarraise Pottery Market ManagerFewer than 10 installs
apply_filters( 'upload_size_limit', $upload, $upload, $post )includes/class-private-files.php:17
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.