Memory limit in WordPress

WordPress needs little memory to work, but only if we talk about the main core. The moment we add heavy plugins, the situation changes.

If you have configured PHP correctly, the system will incorporate that memory configuration that you have available, but if not, by default it will only have a maximum use of 40MB of memory, although if it is a MultiSite, it will go up to 60MB. Obviously, this amount is low, but safe in minimal and basic web hosting.

How to expand memory?

The task is simple, and basically affects two system constants that can be modified from the wp-config.php file, usually located in the root folder of your WordPress installation.

To begin with, we must indicate what is the maximum limit of memory that can be consumed. You should know this when hiring your hosting service. Obviously if you put something huge the most likely thing is that in traffic peaks the server will be saturated, so you have to put something reasonable. The maximum peak that comes by default is 256MB, which is correct, but if you have problems, apart from the fact that you should check why you have them, you can increase it to 384MB. Personally, I would never recommend going from there and this is already an extreme. The ideal is to leave it at 256MB.

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

The question is: What is the figure for normal use? As I said before, the usual value if it is not indicated is 40MB, something that in my opinion is low. The minimum should be 64MB. The maximum? Obviously as an extreme we would have the value of before, which is what it is for, so in this case I recommend something less, which could be 128MB. In case you have problems and have set the maximum to 384MB, maybe the normal could be 256MB.

define( 'WP_MEMORY_LIMIT', '128M' );

With this setup and a good web hosting service, you should have enough for a regular WordPress, and even for a WooCommerce with some traffic. Of course, always remember to have a good cache system of files and objects, especially the latter that allows you to store and cache queries from the database.

About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.