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:

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

  1. Postie icon Postie10,000+ installs apply_filters( 'image_memory_limit', $max_memory ) postie.class.php:462
  2. Document Gallery icon Document Gallery8,000+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) src/inc/class-image-editor-imagick.php:94
  3. RICG Responsive Images icon RICG Responsive Images2,000+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) class-wp-image-editor-respimg.php:42
  4. TheDock Media icon TheDock Media500+ installs apply_filters( 'image_memory_limit', defined( 'WP_MAX_MEMORY_LIMIT' ) ? WP_MAX_MEMORY_LIMIT : '256M' ) includes/class-diagnostics.php:247
  5. binaryImagemagick icon binaryImagemagick60+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) Org_Heigl/BinaryImagemagick.php:175
  6. BuddyPress Album icon BuddyPress Album60+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) includes/class.image.php:217
  7. Smart Watermark icon Smart Watermark50+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) includes/class-wp-image-editor-gd.php:90
  8. Add Watermarks icon Add Watermarks30+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) php/add-watermark.php:529
  9. BuddyPics icon BuddyPics20+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) includes/class.image.php:217
  10. Ninja Shop icon Ninja Shop20+ installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) lib/classes/it-image-utility.php:73
  11. Pixavif: AVIF & WebP Converter, Image Optimizer icon Pixavif: AVIF & WebP Converter, Image OptimizerFewer than 10 installs apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) includes/class-pixavif-capabilities.php:137
  12. Yangra Image Resizer icon 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.