Created
May 7, 2018 12:30
-
-
Save robincornett/a403387cace7439a439ec22efe67dc29 to your computer and use it in GitHub Desktop.
Suggested/optional code for multisite and SuperSide Me, if the preference is to use the same settings on all sites in the network.
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 | |
// Disable the SuperSide Me settings page and customizer panel on child sites | |
if ( ! is_main_site() ) { | |
add_filter( 'supersideme_disable_customizer_panel', '__return_true' ); | |
add_filter( 'supersideme_disable_settings_page', '__return_true' ); | |
} | |
add_filter( 'supersideme_get_plugin_setting', 'prefix_supersideme_use_main_site_setting', 20 ); | |
/** | |
* In a multisite setup, use the main site settings for all child sites. | |
* | |
* @param $setting | |
* | |
* @return array | |
*/ | |
function prefix_supersideme_use_main_site_setting( $setting ) { | |
if ( is_main_site() ) { | |
return $setting; | |
} | |
$main_site = get_network()->site_id; | |
return wp_parse_args( get_blog_option( $main_site, 'supersideme' ), $setting ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment