Title: vip_get_env_var function
Author: WordPress VIP Documentation
Published: November 10, 2021
Last modified: August 5, 2025

---

 1. [Changelog](https://docs.wpvip.com/changelog/)
 2. [VIP MU plugins [Production]](https://docs.wpvip.com/changelog/vip-mu-plugins-production/)
 3. vip_get_env_var function

# vip_get_env_var function

---

 10 November 2021

11:56:33 GMT+0000

 [ VIP MU plugins [Production] ](https://docs.wpvip.com/changelog/vip-mu-plugins-production/)

 [ Permalink  ](https://docs.wpvip.com/changelog/vip-mu-plugins-production/vip_get_env_var-function/)

Added function: vip_get_env_var as a shortcut to requiring Automattic\VIP\Environment::
get_var

    ```php
    $my_env_var = vip_get_env_var( 'FOO',  'BAR' );
    ```

If the key, for the custom environment variable ("FOO") does not exist, the default
value ( "BAR" ) will be returned.

[https://github.com/Automattic/vip-go-mu-plugins/pull/2539](https://github.com/Automattic/vip-go-mu-plugins/pull/2539)