Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
WordPress MU Domain Mapping and the Customizer
Index: domain_mapping.php
===================================================================
--- domain_mapping.php (revision 688919)
+++ domain_mapping.php (working copy)
@@ -685,7 +685,7 @@
}
function redirect_to_mapped_domain() {
- global $current_blog, $wpdb;
+ global $current_blog, $wpdb, $wp_customize;
// don't redirect the main site
if ( is_main_site() )
@@ -695,7 +695,7 @@
return;
// don't redirect theme customizer (WP 3.4)
- if ( isset( $_POST['customize'] ) && isset( $_POST['theme'] ) && $_POST['customize'] == 'on' )
+ if ( is_a( $wp_customize, 'WP_Customize_Manager' ) )
return;
$protocol = is_ssl() ? 'https://' : 'http://';
@03jord33

This comment has been minimized.

Show comment Hide comment
@03jord33

03jord33 Sep 15, 2015

Hi, I'm having trouble adding this code. It created a parse error. Can you tell me where in domain_mapping.php exactly to add the code and if I need to add anything to make it work? I'm not that familiar with PHP. Thanks!

Hi, I'm having trouble adding this code. It created a parse error. Can you tell me where in domain_mapping.php exactly to add the code and if I need to add anything to make it work? I'm not that familiar with PHP. Thanks!

@oneklc

This comment has been minimized.

Show comment Hide comment
@oneklc

oneklc Nov 6, 2015

apply the patch via the command line.
go to the WordPress MU Domain Mapping plugin directory.
copy above and put into a file called (doesn't matter) mapping.patch
then run:
patch < mapping.patch

assumes you are in the mu domain mapping plugin directory.
Make a backup of domain_mapping.php before applying the patch

Btw thanks. Worked like a charm for me.
My domain_mapping.php version number was: 0.5.5.1

oneklc commented Nov 6, 2015

apply the patch via the command line.
go to the WordPress MU Domain Mapping plugin directory.
copy above and put into a file called (doesn't matter) mapping.patch
then run:
patch < mapping.patch

assumes you are in the mu domain mapping plugin directory.
Make a backup of domain_mapping.php before applying the patch

Btw thanks. Worked like a charm for me.
My domain_mapping.php version number was: 0.5.5.1

@cfoellmann

This comment has been minimized.

Show comment Hide comment
@cfoellmann

cfoellmann Oct 9, 2016

found this through search.
Works! THanks

found this through search.
Works! THanks

@arelidev

This comment has been minimized.

Show comment Hide comment
@arelidev

arelidev May 31, 2017

Hey this didn't work for me, I'm getting an error of:

Cheatin’ uh?
Sorry, you are not allowed to customize this site.

Any thoughts?

Hey this didn't work for me, I'm getting an error of:

Cheatin’ uh?
Sorry, you are not allowed to customize this site.

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment