Local was showing the following warning on some of my sites each time I started them:
Warning! This site’s WordPress URL settings do not match the host set in Local.
In these cases the sites actually were working. In most cases I could click the Fix It
button, and nothing would seem to change after it provisions the site. But for a network local site, it would actually break the site. Looking at wp-config.php
I’d notice that the define( 'DOMAIN_CURRENT_SITE', ’site.local' );
line no longer had the domain in it, but what seemed like the content of an entire HTML page. I could replace that with the domain and the site would work again, until I restarted it and Local again presented the warning, which if “fixed” would actually break the site again in the same way.
Eventually I copied the HTML content instead of just deleting it, and pasted it into a new file to view in a web browser. Doing this I realized that the content was actually that of the db-error.php
file this site had from copying the wp-content
folder as a whole from the live website this local is built from (this file is an advanced plugin file you put at the root of the content directory to customize the DB error message shown to visitors). Once I deleted this file from my local site the warning went away completely.
So, it seems that there is a bug in Local that treats the presence of the db-error.php
file as a warning about the URL settings not matching, and further when it tries to “fix” the nonexistent problem it copies that file’s content into the DOMAIN_CURRENT_SITE
define statement in wp-config.php
if that is present, as it is for network sites, rather than putting the domain there. This is a severe bug, if an uncommon one, because what says will fix the local site in truth breaks the local site. I just wanted to bring this up as a bug report, as it is something that should be fixed.