Então, defina dinamicamente WP_SITEURL, WP_HOME, i substitua o wp-config como
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] );
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] );
mas quando eu chamo home_url () ele sempre retorna o hostname x.co.uk
home_url()
não faz uso de nenhuma constante do WordPress. Ele usa uma chamada para get_option( 'home' )
. Para usar WP_HOME, use o circuito curto get_option()
:
add_filter( 'pre_option_home', 'wpse_114486_change_get_option_home' );
/**
* Change get_option( 'home' ) and any functions that rely on it to use
* the value of the WP_HOME constant.
*
* This is not fully tested. Many WordPress functions depend on the value of
* get_option( 'home' ). The ramifications of this filter should be tested
* thoroughly.
*/
function wpse_114486_change_get_option_home( $option ) {
if ( defined ( 'WP_HOME' ) )
return WP_HOME;
return false;
}