With define('WP_DEBUG', true); in wp-config.php, I get the following notice:

Constant EMPTY_TRASH_DAYS already defined in /wp-config.php on line 83

I have checked this file, and this constant is defined just once. I've also searched through all of the php files on the server and don't see that it's defined anywhere else. I've run a thorough search. The only other place it's defined is in default-constants.php:

if ( !defined( 'EMPTY_TRASH_DAYS' ) )
define( 'EMPTY_TRASH_DAYS', 30 );

By commenting out the second line, the notice disappears. But it doesn't make sense to have to edit default-constants.php in order to define the constant in the proper place, which is wp-config.php.

How should I define this constant properly, without editing default-constants.php, which risks being overwritten during an upgrade?

  • 1
    The load process is index.php (in install root, not your theme) -> wp-blog-header.php -> wp-load.php -> wp-config.php. That notice is telling you where it's attempting to set the constant a 2nd time. It seems very strange to see that error that early in the process where only core files have been loaded. I would start by switching to a default theme and disabling all plugins, check if error is still present, then re-enable one-by-one.
    – Milo
    Commented Oct 25, 2018 at 3:45
  • Thank you @Milo! Disabling all plugins and reverting to 2017 theme didn't seem to help. However I found that by commenting out a line in default-constants.php the notice disappears. I've edited the question to include this updated information. However, the problem still isn't fully resolved, in that I shouldn't have to edit default-constants.php. Commented Oct 25, 2018 at 11:26
  • 1
    In wp-config.php there's this line: require_once( ABSPATH . 'wp-settings.php' );. Is your define( 'EMPTY_TRASH_DAYS', 30 ); before this line? Commented Oct 25, 2018 at 11:33
  • Yay @JacobPeattie you solved it! Shall I write up your comment as an answer or would you prefer to do that yourself? Commented Oct 27, 2018 at 4:27

2 Answers 2


When defining any WordPress constants in wp-config.php you need to do it before this line:

require_once( ABSPATH . 'wp-settings.php' );

That line loads many of WordPress’s default constants, and if you haven’t already defined them yourself then they’ll be defined in that line, meaning that any of them that you try to define after this line will have already been defined.

  • That's it! I had defined EMPTY_TRASH_DAYS after calling that line. By defining it before, the problem is solved. Commented Oct 28, 2018 at 10:47

It means that the constant EMPTY_TRASH_DAYS has been defined twice. You need to check and remove the second definition of the same constant. It may be that it's been defined somewhere else. So search all the files of WordPress using grep, find or some advanced text editor like Sublime Text

  • What you've said is all true, but it's information that I already included in the question. I understand the cause of the problem and I already searched inside all of the php files. Incidentally I used sublime text as you suggested, but also Directory Opus. (However I don't think this answer deserves being downvoted.) Commented Oct 27, 2018 at 4:23
  • Did you try a regex search like define\([^"']*?["']EMPTY_TRASH_DAYS ? Commented Oct 27, 2018 at 4:40
  • Yes I had tried that! It's been solved now. The issue is that I had defined this constant after calling wp-settings.php. By defining the constant before calling that, there is no duplicate definition. Commented Oct 28, 2018 at 10:48

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.