Skip to content

Instantly share code, notes, and snippets.

@dirtystylus
Created September 16, 2014 20:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dirtystylus/c34987ceede16668e62f to your computer and use it in GitHub Desktop.
Save dirtystylus/c34987ceede16668e62f to your computer and use it in GitHub Desktop.
WordPress Remove Text Tab Buttons
function _remove_quicktags( $qtInit )
{
// Remove only the 'italic', 'bold', and 'block-quote' buttons
$remove_these = array('strong', 'em', 'block', 'link', 'del', 'ins', 'img', 'ul', 'ol', 'li', 'code', 'more', 'close');
// Convert string to array
$buttons = explode(',', $qtInit['buttons']);
// Loop over items to remove and unset them from the buttons
for( $i=0; $i < count($remove_these); $i++ )
{
if( ($key = array_search($remove_these[$i], $buttons)) !== false)
unset($buttons[$key]);
}
// Convert new buttons array back into a comma-separated string
$qtInit['buttons'] = implode(',', $buttons);
return $qtInit;
}
add_filter('quicktags_settings', '_remove_quicktags', 10, 1);
@dirtystylus
Copy link
Author

@cowgill Thanks for that!

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