Created
March 29, 2020 15:58
-
-
Save oropesa/2e72faaff4763abfc659c214a9cdd792 to your computer and use it in GitHub Desktop.
In wp-config.php add the next lines with mysql DEV or PRO data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In the parent folder where wordpress is located, add the file 'environment' with the words 'DEVELOPMENT', 'PRODUCTION', | |
// or the environment label that you want. | |
// In wp-config.php add: | |
if( ! defined( 'WP_ENVIRONMENT' ) ) { | |
$dir_environment = dirname( dirname( __FILE__ ) ); | |
define( 'WP_ENVIRONMENT', empty( $dir_environment ) ? | |
'PRODUCTION' : file_get_contents( $dir_environment . 'environment' ) ); | |
} | |
$WP_DB_DATA = array( | |
'DEVELOPMENT' => array( 'db_name' => 'local_db_name', 'db_user' => 'root', 'db_pass' => '' ), | |
'PRODUCTION' => array( 'db_name' => 'prod_db_name', 'db_user' => 'prod_db_user', 'db_pass' => 'prod_db_pass' ), | |
); | |
// Then, the lines to define the mysql data looks like: | |
define('DB_NAME', $WP_DB_DATA[ WP_ENVIRONMENT ][ 'db_name' ] ); | |
define('DB_USER', $WP_DB_DATA[ WP_ENVIRONMENT ][ 'db_user' ] ); | |
define('DB_PASSWORD', $WP_DB_DATA[ WP_ENVIRONMENT ][ 'db_pass' ] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment