Source: https://codex.wordpress.org/Running_a_Development_Copy_of_WordPress
As I understand it, I can run a copy of WordPress locally that uses a remote database. Uses everything except the home and site_url from the DB. Perfect for development, however I can’t get it to work.
In my wp-config I have all the correct credentials for my database on a remote server.
In wp-content I created a “db.php” file with the following:
<?php
add_filter ( 'pre_option_home', 'demo.local:8888' );
add_filter ( 'pre_option_siteurl', 'demo.local:8888' );
function test_localhosts( ) {
if (strcasecmp($_SERVER['REQUEST_URI'], '/') {
return "http://demo.mywebsite.io";
}
else return false;
}
?>
Any idea what needs to be changed? Rookie here.