Created
March 18, 2013 20:50
-
-
Save kfriend/5190690 to your computer and use it in GitHub Desktop.
Pre-Wordpress bootstrapping file which removes any development or staging domains from finalized output. Relies on an environment constant WP_ENVIRONMENT. Wordpress's index.php should be renamed to wordpress.php.
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
<?php | |
// Application bootstrap | |
// Start buffering output. We'll do some work on it later. | |
ob_start(); | |
// Bootstrap Wordpress | |
// PHP 5.2 is still in use, so we cannot use __DIR__ | |
require dirname(__FILE__).'/wordpress.php'; | |
if (WP_ENVIRONMENT === 'production') | |
{ | |
$find = array( | |
'example.dev', | |
'staging.example.com', | |
); | |
// Rewrite dev/preview URLs in final output | |
echo str_ireplace($find, 'example.com', ob_get_clean()); | |
} | |
else | |
{ | |
ob_end_flush(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment