Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Simple development / production configuration management in WordPress

Stanislav KhromovStanislav Khromov

I’ve seen a few posts about managing multiple WordPress configuration files in dev / prod environments. (Such as this one.) Many of them seem a bit over-engineered, so why make it more complicated than it has to be? Here is probably the fastest way to setup different configuration files for development and production environments in WordPress:


/* Config loading based on environment variable */
if(getenv('WP_ENV') === 'dev')
    include '';
    include '';


SetEnv WP_ENV   dev


SetEnv WP_ENV   prod

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 1
  • JD
    Posted on

    JD JD

    Reply Author

    Awesome post!

    I just started custom developing my own WordPress themes, this is super helpful. Bookmarked :)