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:

functions.php
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.

  1. Total Upkeep icon 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
  2. MailBard Newsletters icon MailBard Newsletters10+ installs apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes ) legacy/helpers/numbers.php:64
  3. AutoCraft Player icon AutoCraft PlayerFewer than 10 installs apply_filters( 'upload_size_limit', $maxUploadSize ) app/Services/Helper.php:115
  4. Poterie Navarraise Pottery Market Manager icon 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.