Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.