Support » Plugin: WordPress MU Domain Mapping » Making Customizer Work with Domain Mapping on Multisite (WordPress Network)

  • Resolved Terri Ann


    Issue is resolved – posting problem + code solution in case anyone else has the same issue or should the maintainer choose to update the plugin.

    On a site that I had a domain, mapped as primary, I ran into problems using Customizer. When I would load Customizer the left panel would display all the customizer options/settings but the iFrame preview on the right would not load, or in my local environment, would load an error message: Non-existent changeset UUID.


    My Admin > Network > Settings > Domain Mapping options were as follows:

    1 [ ] Remote Login
    2 [x] Permanent redirect (better for your blogger’s pagerank)
    3 [x] User domain mapping page
    4 [x] Redirect administration pages to site’s original domain (remote login disabled if this redirect is disabled)
    5 [ ] Disable primary domain check. Sites will not redirect to one domain name. May cause duplicate content issues.

    What was happening was the customizer iFrame was trying to load but was redirecting to the primary domain.


    I observed logic in the domain-mapping.php file in the function redirect_to_mapped_domain() that was supposed to prevent redirecting customizer requests but it appears the way to identify customizer has changed since then. I added the following condition:

    // But really - don't redirect theme customizer (WP ?)
    if ( isset( $_GET['customize_changeset_uuid'] ) ){

    That complete function now looks like this:

    function redirect_to_mapped_domain() {
    	global $current_blog, $wpdb;
    	// don't redirect the main site
    	if ( is_main_site() )
    	// don't redirect post previews
    	if ( isset( $_GET['preview'] ) && $_GET['preview'] == 'true' )
    	// don't redirect theme customizer (WP 3.4)
    	if ( isset( $_POST['customize'] ) && isset( $_POST['theme'] ) && $_POST['customize'] == 'on' )
    	// But really - don't redirect theme customizer (WP ?)
    	if ( isset( $_GET['customize_changeset_uuid'] ) ){
    	$protocol = is_ssl() ? 'https://' : 'http://';
    	$url = domain_mapping_siteurl( false );
    	if ( $url && $url != untrailingslashit( $protocol . $current_blog->domain . $current_blog->path ) ) {
    		$redirect = get_site_option( 'dm_301_redirect' ) ? '301' : '302';
    		if ( ( defined( 'VHOST' ) && constant( "VHOST" ) != 'yes' ) || ( defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == false ) ) {
    			$_SERVER[ 'REQUEST_URI' ] = str_replace( $current_blog->path, '/', $_SERVER[ 'REQUEST_URI' ] );
    		header( "Location: {$url}{$_SERVER[ 'REQUEST_URI' ]}", true, $redirect );

    Now I can use customizer both locally and live both with and without a domain mapped to the site I am trying to customize.

    • This topic was modified 7 months, 1 week ago by  Terri Ann.
    • This topic was modified 7 months, 1 week ago by  Terri Ann. Reason: Fixing name/keywords to anyone else having this problem can find the solution
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thanks for that fix, really appreciate it.
    The issue has only just been spotted in our organisation.

    Hi, we’ve just discovered that this fixes previewing via Customizer, and allows customization however, the site itself doesn’t render the theme.
    It looks like some old themes render OK but newer ones like “Twentynineteen” fail.
    Have you experienced this issue?

    @numpty I have not experienced any other issues with this fix. Do you mean that the front-end of the site is not using the theme you are viewing/managing in customizer?

    I’m not clear on what failure you’re seeing, you’ll need to be more specific about what actions you’re taking, and what is appearing or behaving differently than your expectation.

    If you can provide that information I can throw twentynineteen on my network site and see if I can reproduce it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.