{$context}_memory_limit
Filter HookDescription
Filters the memory limit allocated for an arbitrary context. The dynamic portion of the hook name, `$context`, refers to an arbitrary context passed on calling the function. This allows for plugins to define their own contexts for raising the memory limit.Hook Information
File Location |
wp-includes/functions.php
View on GitHub
|
Hook Type | Filter |
Line Number | 7908 |
Hook Parameters
Type | Name | Description |
---|---|---|
int|string
|
$filtered_limit
|
Maximum memory limit to allocate for this context. 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 {$context}_memory_limit
add_filter('{$context}_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:7908
- How this hook is used in WordPress core
<?php
7903 * @param int|string $filtered_limit Maximum memory limit to allocate for this context.
7904 * Default WP_MAX_MEMORY_LIMIT` or the original php.ini `memory_limit`,
7905 * whichever is higher. Accepts an integer (bytes), or a
7906 * shorthand string notation, such as '256M'.
7907 */
7908 $filtered_limit = apply_filters( "{$context}_memory_limit", $filtered_limit );
7909 break;
7910 }
7911
7912 $filtered_limit_int = wp_convert_hr_to_bytes( $filtered_limit );
7913
PHP Documentation
<?php
/**
* Filters the memory limit allocated for an arbitrary context.
*
* The dynamic portion of the hook name, `$context`, refers to an arbitrary
* context passed on calling the function. This allows for plugins to define
* their own contexts for raising the memory limit.
*
* @since 4.6.0
*
* @param int|string $filtered_limit Maximum memory limit to allocate for this context.
* 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.