hook a functions to change wp-config from functions.php

There is, as far as I know, no way to hook into wp-config.php from a Theme. For one, wp-config.php shouldn’t be writeable; for another, wp-config.php is executed well-before a Theme’s functions.php file is parsed. For a great overview of how WordPress boots, have a look at this two-part post by Theme.FM (part 1, part 2) or this Explanation with a flowchart by @Rarst.

You might want to look into removing the define() from wp-config.php, and moving it into the Theme? I’ll have to look to see where it gets used, but there’s a good chance that WordPress won’t have looked for it before functions.php gets parsed.

EDIT

As per @ChristopherDavis’ comment below, EMPTY_TRASH_DAYS gets defined at wp-settings.php, via default-constants.php. So, you have to define it in wp-config.php, if you want to override the default.

p.s. why would you want to define the number of trash days in a Theme, anyway?

Leave a Comment