I have seen this question PHP Memory Limit vs. WP Memory Limit and it has a really poor answer and the question isn't that good either.

I am on a dedicated server and can do whatever I want. I want to make sure our site runs as fast as possible and had define( 'WP_MAX_MEMORY_LIMIT', '1024M' ); in our config.

But then our theme had an update and I saw a screen that showed our PHP memory was 1024MB and our WP memory was 40MB. I was like WHAT THE HELL. So I added into the config define('WP_MEMORY_LIMIT', '1024M'); and saw the WP memory had gone up to 1024MB.

So without beating around the bush can I get a very technical answer about what the difference in these two settings are. Did me changing the WP memory limit really have any effect on my site? If so are these setting named horribly? (I fully understand how to allocate memory in PHP - looking at what limitations each setting put on my site.)

Addendum: So if my php.ini has memory limit set to 1024M and WP has no settings I am assuming it can use 1024m or the default of 40M? Then what if there are multiple instances of WP running on the site? Do they each get 1024M or total? Is there a way to set one instance of WP to use less memory? For instance if I have 5 WP sites on a server can I set one to use a max of 64M, another 1024M, and so on?


3 Answers 3


Max is used on the admin side, WP_MEMORY_LIMIT is used on the front end. Don't increase the memory available more than you need to or you'll run the risk of running out of RAM if you have too many simultaneous hits on pages.

  • So you are saying the MAX setting has no effect on the front end? I have 8 MB or RAM - what effect would having tons of pages open have because I have changed the setting from 40 to 1024?
    – STing
    Jun 24, 2016 at 19:50
  • 8MB? Do you mean 8GB? If so, if that is all available to the web server then if your processes take the full 1GB you're giving them you'll be able to have 8 pages served simultaneously. In practice your web server will also be serving up static files, so 7 pages is more realistic, fewer if you allow for the system taking some RAM of course. I haven't come across a site that needs more than the standard 40MB myself. If you're making some whacky queries or using a large number of loops in one page then you might need more. Jun 24, 2016 at 19:55
  • Sorry for the typo 8GB. Machine isn't from 1993.
    – STing
    Jun 24, 2016 at 19:58
  • Ah those were the days Jun 24, 2016 at 19:59

Technically, they are for only one purpose: override memory_limit value in php.ini.

The difference is:

  • WP_MEMORY_LIMIT will permanently override memory_limit if its value is greater than the current value in php.ini.

  • WP_MAX_MEMORY_LIMIT will temporarily override memory_limit with whatever value you defined. And it only happens in some events such as unzip file while installing/upgrading themes, plugins..., editing/previewing images...

  • Thanks for this answer. I am going to add some sub questions to my question so I can be clear on everything.
    – STing
    Jun 27, 2016 at 2:20
  • As i said, if value of WP_MEMORY_LIMIT is greater than one in php.ini, WordPress will use that value. For the sub question, if you want to be clear on everything, why don't try it out? Jun 27, 2016 at 7:24
  • Really really hard to test what I am asking in an accurate way, that is why I am asking it. Also can find really no testing around it too online.
    – STing
    Jun 27, 2016 at 15:07

WP_MEMORY_LIMIT is max memory your WordPress will use while generating a http response, I mean when you a hit a URL, WordPress content has to be generated (html, css, js etc) before it is delivered, Hence any Server side Rendering/creating of the webpage shouldn't use more than WP_MEMORY_LIMIT(I have this set to 64MB.) so if 4 simultaneous URL hits are received on WordPress server then 256MB of memory will be consumed(64x4). Once the page is rendered/ generated and sent over http response this memory is freed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.