What is WP_MEMORY_LIMIT in WordPress?
- WordPress
WP_MEMORY_LIMIT is a constant that sets the maximum amount of memory that WordPress should allocate for PHP.
It’s defined under [github_path location=”wp-includes/default-constants.php#L46-L54″ link=”https://github.com/WordPress/WordPress/blob/master/wp-includes/default-constants.php#L46-L54″]
<?php
if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
define( 'WP_MEMORY_LIMIT', $current_limit );
} elseif ( is_multisite() ) {
define( 'WP_MEMORY_LIMIT', '64M' );
} else {
define( 'WP_MEMORY_LIMIT', '40M' );
}
}The default value is 64M for multisite installation and 40M for non-multisite installations.
It can be changed by defining a personalized value in the wp-config.php file.
For more on how to do it, check:
[manual_related_posts ids=”64970″]