Created
June 25, 2015 13:02
-
-
Save wpmark/d60d54c043623af36e16 to your computer and use it in GitHub Desktop.
Admin Links in Multisite Always go to Original Domain
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 | |
/** | |
* function wpmark_admin_url_to_unmapped_domain() | |
* | |
* makes all the admin links on the site go to the | |
* original unmapped domain. | |
*/ | |
function wpmark_admin_url_to_unmapped_domain( $url, $path, $blog_id ) { | |
/* get the original site url */ | |
$orig_url = get_original_url( $url ); | |
/* check if admin should be https */ | |
if( force_ssl_admin() ) { | |
/* replace all instances of http with https in the original site url */ | |
$orig_url = str_replace( 'http://', 'https://', $orig_url ); | |
} | |
/* return the new admin url include any path passed after it */ | |
return trailingslashit( $orig_url ) . 'wp-admin/' . $path; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment