Skip to content

Instantly share code, notes, and snippets.

@thierrypigot
Created April 23, 2015 10:26
Show Gist options
  • Save thierrypigot/a0c69d8cc7903e742efa to your computer and use it in GitHub Desktop.
Save thierrypigot/a0c69d8cc7903e742efa to your computer and use it in GitHub Desktop.
Remove unused formats in WordPress Editor TinyMCE
<?php
/*
* Modify TinyMCE editor to remove H1.
*/
add_filter('tiny_mce_before_init', 'tp_tinymce_remove_unused_formats' );
function tp_tinymce_remove_unused_formats($init)
{
// Add block format elements you want to show in dropdown
// $init['block_formats'] = 'Paragraph=p;Address=address;Pre=pre;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6';
$init['block_formats'] = 'Paragraph=p;Pre=pre;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6';
return $init;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment