Description:
Having multiple databases on the same implementation of WordPress, you need to select the proper config file before running a selected script from command line
Solution:
Just add a parameter that describes the correct config you need, for example a country parameter, in the script, before loading the config:
//return proper config file
if ( !defined(‘ABSPATH’) )
define(‘ABSPATH’, dirname(__FILE__) . ‘/’);$differentParameter = ”;
if (isset($argv[1]) & is_string($argv[1])) {
$country = $argv[1];
$configFile = ABSPATH . ‘wp-config-’ . $differentParameter . ‘.php’;
if ( file_exists($configFile)) {
require_once($configFile);
}
} else {
require_once(‘wp-config.php’);
}