I would like to add some custom config variables in the
wp-config.php file (not in the
functions.php). Then, I need to access to these variables in my templates.
What is the way to do that ?
Why do you need this?
In wp-config you can set defines. They will be accesible everywhere without needing to use globals. Define something:
Then in your templates you can show the value like this:
Or set the value to a variable:
$var = MY_DEFINE_NAME;.
Thank you for your quick answer. I need to store some page IDs. The page IDs depend of environments (dev, production etc...). Moreover the functions.php is subversionned contrary to the wp-config.php. This is why I need to store some datas in this file.– aguidisAug 13, 2013 at 13:45