Skip to content

Instantly share code, notes, and snippets.

@bogdan-mainwp
Created October 3, 2019 17:00
Show Gist options
  • Save bogdan-mainwp/ae356a1670633ea103b8ddbcbc176630 to your computer and use it in GitHub Desktop.
Save bogdan-mainwp/ae356a1670633ea103b8ddbcbc176630 to your computer and use it in GitHub Desktop.
Hide custom branding for certain user
<?php
// Hide custom branidng for the user with specific ID
// Replace ID with actual ID number
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 == 'ID' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) {        
$option[ 'cancelled_branding' ] = true;    
}       
return $option;
}
// Hide custom branidng for the user with specific username
// Replace USERNAME with actual 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 == 'USERNAME' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) {        
$option[ 'cancelled_branding' ] = true;    
}       
return $option;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment