Skip to content
Advertisement

Using Environment variables in WordPress wp-config

I’m using phpfog.com for hosting and github.com for issue tracking, etc. I have two remotes setup, one to phpfog.com, and the other to github.

In the back-end admin of phpfog you can define Environment Variables. I did so there and want to use them in my wp-config file.

Here’s the code I used:

JavaScript

There must be a cleaner way of doing this…

UPDATE! Here’s the cleaned up code thanks to zerkms

JavaScript

Advertisement

Answer

You could make it twice shorter passing the function result as a constant value without intermediate variable:

JavaScript

Or do that in a loop:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement