Skip to content
This repository was archived by the owner on Dec 1, 2018. It is now read-only.

Using wp env config

Jan Henckens edited this page Dec 23, 2013 · 1 revision

##Usage

wp-env-config comes with 3 configs (local, dev, prod) and it selects the environment used based on the url from which the website is served (those are defined in config.env.php, defaults to the local config).

  1. Add the urls for the enviroments you want to use to config.env.php:

    if (!defined('ENV')) {
        switch (strtolower($_SERVER['HTTP_HOST'])) {
        case 'website.tld' :
        case 'www.website.tld' :
            define('ENV', 'prod');
            define('ENV_FULL', 'Production');
            define('ENV_DEBUG', false);
            break;

    To add an environment with a different name you copy the switch above, change the ENV parameter and add a config.newenv.php to the config/ folder.

  2. In the environment file in question, add your database details:

    $config_db = '';
    $config_user = '';
    $config_pw = '';
    $config_host = '';
    $config_charset = 'utf8';
    $config_tableprefix = 'wp_';
    define('DB_COLLATE', ''); 
  3. You're done! You can now deploy your site to your various environments and, if the urls you entered match up, everything should just work :)

Clone this wiki locally