Created
May 21, 2014 11:46
-
-
Save Jursdotme/a6bc07da609f8a753857 to your computer and use it in GitHub Desktop.
Use Live database on local Wordpress install.
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
// Use live database on local installation | |
<?php | |
// paste this in a (new) file, wp-content/db.php | |
add_filter ( 'pre_option_home', 'test_localhosts' ); | |
add_filter ( 'pre_option_siteurl', 'test_localhosts' ); | |
function test_localhosts( ) { | |
if (strcasecmp($_SERVER['SERVER_NAME'], '.dev') != 0 || strcasecmp($_SERVER['SERVER_NAME'], 'localhost') != 0 ) { | |
return "http://".$_SERVER['SERVER_NAME']; | |
} | |
else return false; // act as normal; will pull main site info from db | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this (and modify as needed) to
/wp-content
.Based on the technique on this page.