Skip to content

Instantly share code, notes, and snippets.

@INDIAN2020
Forked from yanknudtskov/functions.php
Created June 18, 2018 06:11
Show Gist options
  • Save INDIAN2020/5c5b079c236f0f8883eb60d2696a461a to your computer and use it in GitHub Desktop.
Save INDIAN2020/5c5b079c236f0f8883eb60d2696a461a to your computer and use it in GitHub Desktop.
Remove Heading from the WordPress Editor #tinymce #removeheadings
<?php
/**
* Remove the h4 to h6 tag from the WordPress editor.
*
* @param array $settings The array of editor settings
* @return array The modified edit settings
*/
function remove_headings_from_editor( $settings ) {
// Default as example
// $settings['block_formats'] = 'Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;';
$settings['block_formats'] = 'Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;';
return $settings;
}
add_filter( 'tiny_mce_before_init', 'remove_headings_from_editor' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment