-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use application.pantheon.php to define WP_HOME
and make it available for future application.php modifications
- Loading branch information
1 parent
d3b201a
commit 3da040a
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Pantheon platform application settings. | ||
* | ||
* IMPORTANT NOTE: | ||
* Do not modify this file. This file is maintained by Pantheon. | ||
* | ||
* Site-specific modifications belong in config/application.php, not this file. | ||
* This file may change in future releases and modifications would cause | ||
* conflicts when attempting to apply upstream updates. | ||
*/ | ||
|
||
use Roots\WPConfig\Config; | ||
use function Env\env; | ||
|
||
if ( isset( $_ENV['PANTHEON_ENVIRONMENT'] ) && 'lando' !== $_ENV['PANTHEON_ENVIRONMENT'] ) { | ||
// We can use PANTHEON_SITE_NAME here because it's safe to assume we're on a Pantheon environment if PANTHEON_ENVIRONMENT is set. | ||
$sitename = $_ENV['PANTHEON_SITE_NAME']; | ||
$baseurl = $_ENV['PANTHEON_ENVIRONMENT'] . '-' . $sitename . '.pantheonsite.io'; | ||
|
||
$scheme = 'http'; | ||
if ( isset( $_SERVER['HTTPS'] ) && 'on' === $_SERVER['HTTPS'] ) { | ||
$scheme = 'https'; | ||
} | ||
|
||
// Define the WP_HOME and WP_SITEURL constants if they aren't already defined. | ||
if ( ! env( 'WP_HOME' ) ) { | ||
// If HTTP_HOST is set, use that as the base URL. It's probably more accurate. | ||
if ( isset( $_SERVER['HTTP_HOST'] ) ) { | ||
$baseurl = $_SERVER['HTTP_HOST']; | ||
} | ||
|
||
$homeurl = $scheme . '://' . $baseurl; | ||
Config::define( 'WP_HOME', $homeurl ); | ||
|
||
if ( ! env( 'WP_SITEURL' ) ) { | ||
Config::define( 'WP_SITEURL', $homeurl . '/wp' ); | ||
} | ||
} | ||
} |