PHP Warning: Constant WP_MEMORY_LIMIT Already Defined In wp-config.php
-
I noticed that on a number of sites I manage, the error_log in /wp-admin is filling up with PHP warnings like these:
[18-May-2023 16:23:14 UTC] PHP Warning: Constant WP_MEMORY_LIMIT already defined in /home/username/domain.com/wp-config.php on line 100 [19-May-2023 16:23:10 UTC] PHP Warning: Constant WP_MEMORY_LIMIT already defined in /home/username/domain.com/wp-config.php on line 100
Once a day, every day, same time, which makes it look like a cron-related thing.
The sites do all have the WP_MEMORY_LIMIT constant defined in wp-config.php in order to increase the memory limit. I haven’t been able to tell where–other than in wp-config.php–WordPress is trying to re-define WP_MEMORY_LIMIT to cause the warning.
So I set up a test site with no plugins and used the default Twenty Twenty Two theme.
The warnings continue, so it seems like it’s got to be coming from WordPress itself.
I SSH’d into the server and from the root folder, ran the following:
grep -r 'WP_MEMORY_LIMIT' .
The only relevant result was in /wp-includes/default-constants.php, but it’s contained within a conditional block that fires the code only if WP_MEMORY_LIMIT is not already defined, so that doesn’t appear to be the culprit.
Is anybody else getting these warnings or know how to fix them?
- The topic ‘PHP Warning: Constant WP_MEMORY_LIMIT Already Defined In wp-config.php’ is closed to new replies.