Created
May 28, 2015 08:34
-
-
Save sjaved87/b5bc6053e04be0fbe729 to your computer and use it in GitHub Desktop.
Remove tinyMCE buttons based on role
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
if( !function_exists('wpmu_hide_itmes') ): | |
function wpmu_hide_itmes($buttons) | |
{ | |
//do not remoe any button if its super admin or pro users | |
if(current_user_can('pro') or is_super_admin() ) return $buttons; | |
//Remove the text color selector | |
$remove = array( 'msp_shortcodes_button', 'wsalestoolbox_tc_button', 'icon' ); | |
//Find the array key and then unset | |
if($remove){ | |
foreach ($remove as $vlaue){ | |
if ( ( $key = array_search($vlaue,$buttons) ) !== false ) | |
unset($buttons[$key]); | |
} | |
} | |
return $buttons; | |
} | |
endif; | |
add_filter('mce_buttons', 'wpmu_hide_itmes', 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If any one have confusion using this code then feel free to post a comment.