WordPress filter hook · part of WordPress core
image_memory_limit
A WordPress core filter that 12 plugins also fire themselves, running on 21K+ sites between them.
“This filter is documented in wp-includes/class-wp-image-editor-imagick.php”
How to use image_memory_limit
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'image_memory_limit', function( $max_memory ) {
// Change $max_memory here.
return $max_memory;
}, 10, 1 );Argument names come from Postie'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 →
12 plugins that fire image_memory_limit
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Postie10,000+ installs
apply_filters( 'image_memory_limit', $max_memory )postie.class.php:462 -
Document Gallery8,000+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )src/inc/class-image-editor-imagick.php:94 -
RICG Responsive Images2,000+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )class-wp-image-editor-respimg.php:42 -
TheDock Media500+ installs
apply_filters( 'image_memory_limit', defined( 'WP_MAX_MEMORY_LIMIT' ) ? WP_MAX_MEMORY_LIMIT : '256M' )includes/class-diagnostics.php:247 -
binaryImagemagick60+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )Org_Heigl/BinaryImagemagick.php:175 -
BuddyPress Album60+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )includes/class.image.php:217 -
Smart Watermark50+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )includes/class-wp-image-editor-gd.php:90 -
Add Watermarks30+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )php/add-watermark.php:529 -
BuddyPics20+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )includes/class.image.php:217 -
Ninja Shop20+ installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )lib/classes/it-image-utility.php:73 -
Pixavif: AVIF & WebP Converter, Image OptimizerFewer than 10 installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )includes/class-pixavif-capabilities.php:137 -
Yangra Image ResizerFewer than 10 installs
apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT )classes/yaimre-helper.php:902
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.