I have a wp-config.php file with these variables:
define( 'WP_HOME', $_ENV['WP_HOME'] ); define( 'WP_SITEURL', $_ENV['WP_SITEURL'] );
In my current setup, this uses dotenv to load the values from a .env file on the server. But for this question's purpose, I've also tried hardcoding the domain in both places.
On my local server, the URL is https://sitename.test. It works as it should, and at the /wp-admin/options-general.php URL, the correct domain name is in place in both the WordPress Address (URL) and Site Address (URL) fields, which are themselves disabled.
On the remote server (https://dev.sitename.com), the correct URL does appear in the WordPress Address (URL) field, but it does not appear in the Site Address (URL) field, even though both form fields are disabled.
I would be inclined to ignore this, but on the remote server it appears to cause some PHP errors about missing 'host' attributes, and some missing icons and such across the wp-admin screens.
The main difference between the local URL and the remote URL is that the remote one is a subdomain. What other things should I be looking for here? I feel confident that the issue is not caused by dotenv since the same issue happens when I hardcode the URL into wp-config.php.