1

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.

1 Answer 1

2

This appears to be resolved if I add a home value to the wp_options table. For example, I added https://www.productionurl.com to this dev server's options table, even though that URL does not have a WordPress installation, and this dev installation began loading the proper config item from wp-config.php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.