Manage WordPress Connections, Settings in One Place for Multiple WordPress Sites on Same Domain


I have hosted 4 wordpress sites on the same VPS, similar to the trick described in this post, I can actually move common settings/connection details for all wordpress sites out to a common directory (which is not accessible in public by HTTP or HTTPS requests).

File wp-conn.php stores the common database access details.

1
2
3
4
5
6
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** MySQL database username */
define('DB_USER', 'username');
/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** MySQL database username */
define('DB_USER', 'username');
/** MySQL database password */
define('DB_PASSWORD', 'password');

File wp-ftp-conn.php stores the FTP details if you need frequent plugin updates (see this post for more details)

1
2
3
4
/** Setup FTP Details **/
define("FTP_HOST", "localhost");
define("FTP_USER", "username");
define("FTP_PASS", "password");
/** Setup FTP Details **/
define("FTP_HOST", "localhost");
define("FTP_USER", "username");
define("FTP_PASS", "password");

File wp-setting.php stores the common WP settings (see this post, this post and this post for more details)

1
2
3
define('DISABLE_WP_CRON', true);
define('WP_POST_REVISIONS', false);
define('EMPTY_TRASH_DAYS', 7);
define('DISABLE_WP_CRON', true);
define('WP_POST_REVISIONS', false);
define('EMPTY_TRASH_DAYS', 7);

Then modify the wp-config.php for each WordPress site to (remove the corresponding lines):

require('/common/path/wp-conn.php');
require('/common/path/wp-ftp-conn.php');
require('/common/path/wp-setting.php');

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
298 words
Last Post: MSTest - Out of Memory - LAA for 32-bit Test Agent
Next Post: Area of the Shadow? - The Monte Carlo Solution in VBScript

The Permanent URL is: Manage WordPress Connections, Settings in One Place for Multiple WordPress Sites on Same Domain

Leave a Reply