The WordPress Memory Limit is the maximum amount of memory (RAM) that your site can use at one time. You generally have a memory limit issue when your installation does not meet minimum server requirements for a modern WordPress installation. When you reach your memory limit, you’ll encounter a fatal error.
Several things consume memory, such as WordPress itself, the theme you’re using, and the plugins installed on your site. The more content and features you add to your website, the bigger your memory limit needs to be.
The default memory limit for WordPress is 32MB. Suppose you’re using a premium WordPress theme and you start encountering unexpected issues. In that case, it may be time to adjust your memory limit to meet the standards for a modern WordPress installation.
Increasing the WordPress memory limit
Increase the WordPress Memory Limit is a standard practice in WordPress and you’ll find this in the official WordPress documentation (Increasing memory allocated to PHP), otherwise follow the simple steps below:
- Locate your
wp-config.php
file in the root folder of your WordPress installation. If you’re running a Bitnami setup, the file is at/opt/bitnami/apps/wordpress/htdocs/wp-config.php
. - Open the
wp-config.php
file in a text editor and add the codedefine( 'WP_MEMORY_LIMIT', '96M' );
generally afterdefine(‘WP_DEBUG’, false);
and always before thewp-settings.php
inclusion. - Save the file.
- If you’re running a Bitnami installation, you may need to restart Apache from the command line using
sudo /opt/bitnami/ctlscript.sh restart apache
for the changes to take effect.
In this example, we have increased the limit to 96M (megabytes) which should be sufficient for most basic WordPress theme installations. The value can be adjusted if necessary.
Increasing memory here will only be active if you have sufficient memory available on your server. Also, take care not to allocate all your server memory to WordPress. As a general rule, we suggest allocating 50% of your server memory to WordPress.
If you’re using complex drag-and-drop editors or a significant number of plugins, you may find that you need to increase the memory limit further. Between 512M and 1024M should achieve optimal performance of your installation, particularly for the WordPress Administration area, which requires additional resources.
Increasing memory for the WordPress administration area
If memory issues only exist in the WordPress Administration area, the code define ( 'WP_MAX_MEMORY_LIMIT', '128M' );
can be used to define a memory limit specifically for this part of WordPress. Your memory allocation can be higher or lower than the general WordPress memory allocation discussed above. Remember to replace the text 128M with the amount of memory you’d like to assign.