I need to set options of a specific plugin at the parent site of a network and use those settings globally to override each site, unless set to false
.
Neither get_option()
or get_site_option()
does the task. They just return values relative to the current site. All the solutions I have encountered are methods to use database query with $wpdb->get_results()
but I figure the mighty WP must have a built-in method to do this task.
Example use
- Plugin setting to display ad banner set to
true
at parent site - The plugin is available across the network to insert banners but cannot be disabled because the condition only accepts the parent value unless set to
false
code scenario (not an actual WP function)
if( get_parent_site_option('adbanners')['show_banners'] == 1 ) {
showAds();
}else
if( get_site_option('adbanners')['show_banners'] == 1 ) {
showAds();
}else{
// ads disabled on this current site
}
Is there a WP function to do this without the direct DB query method?