tl;dr: Manually set value or the default values of WP_MEMORY_LIMIT
/WP_MAX_MEMORY_LIMIT
have no effect if WP_MEMORY_LIMIT
/WP_MAX_MEMORY_LIMIT
less than or equal to the memory limit of PHP (hereinafter memory_limit
called) is. They are used to set too low values of memory_limit
dynamically to a recommended minimum.
- The constant
WP_MEMORY_LIMIT
can optionally inwp-config.php
withdefine('WP_MEMORY_LIMIT', 'XXXM');
be set. - The constant
WP_MAX_MEMORY_LIMIT
can optionally inwp-config.php
withdefine('WP_MAX_MEMORY_LIMIT', 'XXXM');
be set. - Is
WP_MEMORY_LIMIT
not set, applies to its default value:memory_limit
, provided the value ofmemory_limit
cannot be changed dynamically,- 64 MB if it is a multisite,
- 40MB otherwise.
- Is
WP_MAX_MEMORY_LIMIT
not set, applies to its default value:memory_limit
, provided the value ofmemory_limit
is not dynamically changeable or if it is unbounded (-1) or greater than or equal to 256 MB,- 256 MB otherwise.
- The default values have been raised again and again in the past.
WP_MEMORY_LIMIT
changed everywhere using the function ini_set() dynamicmemory_limit
, ifWP_MEMORY_LIMIT
larger than the current onememory_limit
or whenWP_MEMORY_LIMIT
is unlimited (-1).WP_MAX_MEMORY_LIMIT
changed in the backend (more precisely: whenever the function wp_raise_memory_limit() called in different contexts [admin, image]) using the function ini_set() dynamicmemory_limit
, ifWP_MAX_MEMORY_LIMIT
larger than the current onememory_limit
or whenWP_MAX_MEMORY_LIMIT
is unlimited (-1).- The logic of
WP_MAX_MEMORY_LIMIT
runs after the logic ofWP_MEMORY_LIMIT
, so thatWP_MEMORY_LIMIT
in the frontend andWP_MAX_MEMORY_LIMIT
takes effect in the backend. - Much of the logic described above is in function wp_initial_constants() (
/wp-includes/default-constants.php
) as in wp_raise_memory_limit() (/wp-includes/functions.php
) instead of. - The value
memory_limit = XXXM
inphp.ini
Are definedmemory_limit
(after restarting the web service). - The value
php_value memory_limit XXXM
in.htaccess
Are definedmemory_limit
for all PHP files in the folder or its subfolder in which the.htaccess
located. - The web server can prevent the value of the memory limit from being changed with ini_set() or from exceeding a specified value (see php_admin_value ).
memory_limit
applies per process: An increase ofmemory_limit
can cause the number of parallel PHP requests to decrease. The value should therefore be chosen carefully (256 MB, in exceptional cases 512 MB).- In the WordPress backend under Tools > Website State, the values of
memory_limit
(Section: Server), as well as fromWP_MEMORY_LIMIT
andWP_MAX_MEMORY_LIMIT
(section WordPress constants) can be read out.