Created
June 20, 2024 10:43
-
-
Save mgussekloo/c682716f9251f6cf44433362ba863c11 to your computer and use it in GitHub Desktop.
Plugin that lets you share Wordpress sites through Expose (expose.dev)
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 | |
// phpcs:ignoreFile | |
define( 'EXPOSED_DOMAIN', 'xxx.sharedwithexpose.com' ); | |
define( 'REAL_DOMAIN', 'mydomain.test' ); | |
// Load only if we are running under Expose. | |
if ( empty( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) || strpos($_SERVER['HTTP_X_ORIGINAL_HOST'], EXPOSED_DOMAIN) === false) { | |
return; | |
} | |
ob_start(function($buffer) { | |
return str_replace(REAL_DOMAIN, EXPOSED_DOMAIN, $buffer); | |
}); | |
add_action('shutdown', function() { | |
ob_end_flush(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment