[wp-trac] [WordPress Trac] #36426: WP Admin memory limit not increasing to base limit by default

WordPress Trac noreply at wordpress.org
Wed Apr 6 12:54:56 UTC 2016


#36426: WP Admin memory limit not increasing to base limit by default
-----------------------------------------+-----------------------------
 Reporter:  eclare                       |      Owner:
     Type:  enhancement                  |     Status:  new
 Priority:  normal                       |  Milestone:  Awaiting Review
Component:  Administration               |    Version:  trunk
 Severity:  normal                       |   Keywords:
  Focuses:  administration, performance  |
-----------------------------------------+-----------------------------
 We have 2 constants that can be set in wp-config.php (and by using
 filters, afaik), for example:
 {{{#!php
 define( 'WP_MEMORY_LIMIT', '512M' ); // increases WP base (front-end)
 limit
 define( 'WP_MAX_MEMORY_LIMIT', '512M'); // increases WP admin (back-end)
 limit
 }}}

 The former isn't really known, which you can Google to find out. People
 usually only use the first constant.
 If the 2nd constant (WP_MAX_MEMORY_LIMIT) is not set, it defaults to 256M.
 WP_MEMORY_LIMIT can be higher than that though, so we could safely
 increase WP_MAX_MEMORY_LIMIT to match WP_MEMORY_LIMIT if WP_MEMORY_LIMIT
 is higher and WP_MAX_MEMORY_LIMIT is not set manually to a lower (than
 WP_MEMORY_LIMIT) value.

 What I mean in coding terms:
 {{{
 if(!isset(WP_MAX_MEMORY_LIMIT) && isset(WP_MEMORY_LIMIT)){
     if(WP_MEMORY_LIMIT>DEFAULT_WP_MAX_MEMORY_LIMIT){
     //NOTE to the line above: this requires parsing the actual value in
 these constants as the strings can be like: 512M, 1G etc.; the
 DEFAULT_WP_MAX_MEMORY_LIMIT is a thing I came up with, currently the
 default admin memory limit is 256M
         define( 'WP_MAX_MEMORY_LIMIT', WP_MEMORY_LIMIT);
     }
 }
 }}}

 All these values can be checked with the Bulletproof Security plugin,
 under BPS Security -> System Info.
 Side note: imho WP_MAX_MEMORY_LIMIT should be renamed to something like
 WP_ADMIN_MEMORY_LIMIT, but that's another issue.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36426>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list