- MainWP KB
- Extensions
- White Label
-
Getting Started
-
General
-
Extensions
- Boilerplate
- Code Snippets
- Favorites
- Comments
- MainWP Buddy
- Bulk Settings Manager
- UpdraftPlus Backups
- Advanced Uptime Monitor
- Post Plus
- Vulnerability Checker
- WordPress SEO
- Wordfence
- Page Speed
- Custom Post Types
- Staging
- Team Control
- Clone
- File Uploader
- Maintenance
- Virusdie
- BackWPup
- White Label
- Time Capsule
- Pro Reports
- Article Uploader
- iThemes Security
- Rocket
- Post Dripper
- Sucuri
- WooCommerce Status
- WP Compress
- Piwik
- Google Analytics
- WooCommerce Shortcuts
- Custom Dashboard
- Time Tracker
- Cost Tracker Assistant
- Fathom
- URL Extractor
- SSL Monitor
- Jetpack Scan
- Jetpack Protect
- Database Updater
- Termageddon
- Pressable
- Atarim
- Cache Control
- Domain Monitor
- Lighthouse
- Dashboard Lock
- Post SMTP
-
Troubleshooting
-
FAQs
-
Affiliates
-
Sites
-
Insights
-
Cost Tracker
-
Miscellaneous
Remove White Label Settings for a Specific User on Child Sites
MainWP Child 4.0.3, released on October 1st, 2019, introduced one handy filter mainwp_child_branding_init_options that can be used to hide white label settings for a specific user on child sites.
Let’s see the usage example:
add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options' );
function mycustom_mainwp_child_branding_init_options( $option ) {
$current_user_id = get_current_user_id();
if ( $current_user_id == '1' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) {
$option[ 'cancelled_branding' ] = true;
}
return $option;
}
In this example, all custom MainWP White Label Extension options will be applied for all users on the child site except for the user with ID 1.
Also, the filter can be used to hide white label settings for a user with a specific username.
add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options' );
function mycustom_mainwp_child_branding_init_options( $option ) {
$current_user = wp_get_current_user();
if ( $current_user && $current_user->user_login == 'bogdan' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) {
$option[ 'cancelled_branding' ] = true;
}
return $option;
}
In this example, the user with the username “bogdan” won’t be affected by the white label settings.
If you use the MainWP Code Snippets Extension, you will be able to apply this snippet to all your sites at once.