Filter hook 'admin_memory_limit'

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

View Source

admin_memory_limit

Filter Hook
Description
Filters the maximum memory limit available for administration screens. 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.

Hook Information

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

Hook Parameters

Type Name Description
int|string $filtered_limit The maximum WordPress memory limit. Accepts an integer (bytes), or a shorthand string notation, such as '256M'.

Usage Examples

Basic Usage
<?php
// Hook into admin_memory_limit
add_filter('admin_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:7859 - How this hook is used in WordPress core
<?php
7854  			 * @since 4.6.0 The default now takes the original `memory_limit` into account.
7855  			 *
7856  			 * @param int|string $filtered_limit The maximum WordPress memory limit. Accepts an integer
7857  			 *                                   (bytes), or a shorthand string notation, such as '256M'.
7858  			 */
7859  			$filtered_limit = apply_filters( 'admin_memory_limit', $filtered_limit );
7860  			break;
7861  
7862  		case 'image':
7863  			/**
7864  			 * Filters the memory limit allocated for image manipulation.

PHP Documentation

<?php
/**
			 * Filters the maximum memory limit available for administration screens.
			 *
			 * 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.
			 *
			 * @since 3.0.0
			 * @since 4.6.0 The default now takes the original `memory_limit` into account.
			 *
			 * @param int|string $filtered_limit The maximum WordPress memory limit. 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.