Skip to content

Instantly share code, notes, and snippets.

@sjaved87
Created May 28, 2015 08:34
Show Gist options
  • Save sjaved87/b5bc6053e04be0fbe729 to your computer and use it in GitHub Desktop.
Save sjaved87/b5bc6053e04be0fbe729 to your computer and use it in GitHub Desktop.
Remove tinyMCE buttons based on role
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);
@sjaved87
Copy link
Author

If any one have confusion using this code then feel free to post a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment