admin_memory_limit

Filters the maximum memory limit available for administration screens.

Description

apply_filters( 'admin_memory_limit', (int|string) $filtered_limit ); 

This only applies to administrators, who may require more memory for tasks like updates. Memory limits when processing images (uploaded or edited by users of any role) are handled separately.

The WP_MAX_MEMORY_LIMIT constant specifically defines the maximum memory limit available when in the administration back end. The default is 256M (256 megabytes of memory) or the original memory_limit php.ini value if this is higher.

Parameters (1)

0. $filtered_limit (int|string)
The maximum WordPress memory limit. 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( 'admin_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 admin_memory_limit callback 
  2. function filter_admin_memory_limit( $filtered_limit ) { 
  3. // make filter magic happen here... 
  4. return $filtered_limit
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'admin_memory_limit', 'filter_admin_memory_limit', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'admin_memory_limit', 'filter_admin_memory_limit', 10, 1 ); 

Defined (1)

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

/wp-includes/functions.php  
  1. $filtered_limit = apply_filters( 'admin_memory_limit', $filtered_limit );