Need function to remove visual editor toolbar button based on role.
-
Trying to remove a button from the visual editor toolbar based on the users role.
Button source:
<button id=”mceu_16-open” tabindex=”-1″ type=”button” role=”presentation”>
<i class=”mce-ico mce-i-icon wsalestoolbox-own-icon”></i>
<span></span>
<i class=”mce-caret”></i>
</button>
</div>Someone gave the below function but I can’t get it to work and don’t really understand how this would work? Is it close?
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( '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');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Need function to remove visual editor toolbar button based on role.’ is closed to new replies.