Skip to content

Instantly share code, notes, and snippets.

@matrixwd
Last active October 8, 2017 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matrixwd/442ff72d9fcd95a28537e3e73f0136e9 to your computer and use it in GitHub Desktop.
Save matrixwd/442ff72d9fcd95a28537e3e73f0136e9 to your computer and use it in GitHub Desktop.
Remove Heading tags from Wordpress WYSIWYG / Tinymce editor based on category
/*
This function does just what it says.
Input your category in the in_category()
Author: Eric Murphy
URL: https://www.matrixwebdesigners.com/
REF: https://codex.wordpress.org/Conditional_Tags#A_Category_Page
You can also use this for other things like pages, etc..
*/
function remove_wysiwyg_tags_based_on_category($arr){
if ( in_category( 'yourCateory' ) ) {
$arr['block_formats'] = 'Paragraph=p;Heading 3=h3;Heading 4=h4';
return $arr;
}
return $arr;
}
add_filter('tiny_mce_before_init', 'remove_wysiwyg_tags_based_on_category');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment