Last active
April 15, 2021 04:37
-
-
Save harisrozak/b21f76f26116056d9a38e99397f048e8 to your computer and use it in GitHub Desktop.
Main multisite-site on app.example.com. Also fixed `cookies` related error on child-sites login
This file contains hidden or 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 | |
/** | |
* Modify multisite childs subdomain path | |
* The main multisite path is on app.example.com | |
* And then it's children should be on foo.example.com, bar.example.com, etc. | |
* This code should be located on mu-plugins folder | |
*/ | |
if ( ! function_exists( 'harisrozak_change_site_subdomain' ) ) { | |
function commercioo_change_site_subdomain( $data ) { | |
$data['domain'] = preg_replace( '/(.*).app.(.*)/', '$1.$2', $data['domain'] ); | |
return $data; | |
} | |
} | |
add_filter( 'wp_normalize_site_data', 'harisrozak_change_site_subdomain', 10, 1 ); |
This file contains hidden or 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 | |
/** | |
* Fix error on child-site login with `Cookies` error message | |
* Put this line on wp-config.php | |
*/ | |
define( 'COOKIE_DOMAIN', strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment