Hello,
I try to set the cookie domain for my wordpress bedrock environment with sage theme. But it seems, that wordpress to not recognize the change:
I added
COOKIE_DOMAIN=sub.my_domain.de
to my .env file.
The wordpress behaviour on cookies did not change, so I output some vars with
echo "WP_SITEURL" . WP_SITEURL . "<br />";
echo "COOKIE_DOMAIN" . COOKIE_DOMAIN . "<br />";
WP_SITEURL was set to the value I gave it in .env file. “COOKIE_DOMAIN” was just empty. For COOKIEPATH it`s the same.
Is there a list, which values are accepted in .env file and than defined in PHP? What else could be wrong?
Thank you!
I’ve actually done the same thing, but an environment variable is not the same thing as a constant. See here: https://github.com/roots/bedrock/blob/master/config/application.php#L42-L45
You still need to define the constant in one of your PHP files with define('COOKIE_DOMAIN', getenv('COOKIE_DOMAIN'));
Ok, thank you. I thought, I could change every wordpress option in the .env file. Is documented, which wordpress options I can change in the .env file?
ben
August 18, 2015, 7:54pm
4
Search for getenv in config/application.php
<?php
$root_dir = dirname(__DIR__);
$webroot_dir = $root_dir . '/web';
/**
* Use Dotenv to set required environment variables and load .env file in root
*/
$dotenv = new Dotenv\Dotenv($root_dir);
if (file_exists($root_dir . '/.env')) {
$dotenv->load();
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD', 'WP_HOME', 'WP_SITEURL']);
}
/**
* Set up our global environment constant and load its config first
* Default: development
*/
define('WP_ENV', getenv('WP_ENV') ?: 'development');
$env_config = __DIR__ . '/environments/' . WP_ENV . '.php';
This file has been truncated. show original