<context>_memory_limit

Filters the memory limit allocated for arbitrary contexts.

Description

apply_filters( '<context>_memory_limit', (int|string) $filtered_limit ); 

The dynamic portion(s) of the hook name refer to an arbitrary context passed on calling the function. This allows for plugins to define their own contexts for raising the memory limit.

Parameters (1)

0. $filtered_limit (int|string)
Maximum memory limit to allocate for images. Default 256M or the original php.ini memory_limit,, whichever is higher. Accepts an integer (bytes), or a shorthand string notation, such as 256M .

Usage

To run the hook, copy the example below.
  1. $filtered_limit = apply_filters( '{$context}_memory_limit', $filtered_limit ); 
  2.  
  3. if ( !empty( $filtered_limit ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the <context>_memory_limit callback 
  2. function filter_context_memory_limit( $filtered_limit ) { 
  3. // make filter magic happen here... 
  4. return $filtered_limit
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "{$context}_memory_limit", 'filter_context_memory_limit', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "{$context}_memory_limit", 'filter_context_memory_limit', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/functions.php  
  1. $filtered_limit = apply_filters( "{$context}_memory_limit", $filtered_limit );