Filter hook 'image_memory_limit'

in WP Core File wp-includes/functions.php at line 7875

View Source

image_memory_limit

Filter Hook
Description
Filters the memory limit allocated for image manipulation.

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Filter
Line Number 7875

Hook Parameters

Type Name Description
int|string $filtered_limit Maximum memory limit to allocate for image processing. Default `WP_MAX_MEMORY_LIMIT` or the original php.ini `memory_limit`, whichever is higher. Accepts an integer (bytes), or a shorthand string notation, such as '256M'.

Usage Examples

Basic Usage
<?php
// Hook into image_memory_limit
add_filter('image_memory_limit', 'my_custom_filter', 10, 1);

function my_custom_filter($filtered_limit) {
    // Your custom filtering logic here
    return $filtered_limit;
}

Source Code Context

wp-includes/functions.php:7875 - How this hook is used in WordPress core
<?php
7870  			 *                                   Default `WP_MAX_MEMORY_LIMIT` or the original
7871  			 *                                   php.ini `memory_limit`, whichever is higher.
7872  			 *                                   Accepts an integer (bytes), or a shorthand string
7873  			 *                                   notation, such as '256M'.
7874  			 */
7875  			$filtered_limit = apply_filters( 'image_memory_limit', $filtered_limit );
7876  			break;
7877  
7878  		case 'cron':
7879  			/**
7880  			 * Filters the memory limit allocated for WP-Cron event processing.

PHP Documentation

<?php
/**
			 * Filters the memory limit allocated for image manipulation.
			 *
			 * @since 3.5.0
			 * @since 4.6.0 The default now takes the original `memory_limit` into account.
			 *
			 * @param int|string $filtered_limit Maximum memory limit to allocate for image processing.
			 *                                   Default `WP_MAX_MEMORY_LIMIT` or the original
			 *                                   php.ini `memory_limit`, whichever is higher.
			 *                                   Accepts an integer (bytes), or a shorthand string
			 *                                   notation, such as '256M'.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.