Forked from robneu/modify-tinymce-editor-to-remove-h1.php
Last active
August 29, 2015 14:05
-
-
Save GaryJones/30f41acdf72f705ca61a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* File level DocBlock here - includes/class-remove-h1-format.php */ | |
/* Class level DocBlock here */ | |
class Remove_H1_Format { | |
/* | |
* Modify TinyMCE editor to remove H1. | |
*/ | |
public function remove( $init ) { | |
// GJ: No need for the filter - if they don't want it running, deactivate the plugin. | |
// Add block format elements you want to show in dropdown | |
// GJ: I'd probably go for str_replace() here, so that you don't trump over | |
// other filters modifying the same block_formats. | |
$init['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Address=address;Pre=pre'; | |
return $init; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Remove H1 Format | |
* Plugin URI: http://calliaweb.co.uk/modify-tinymce-editor/ | |
* Description: A simple plugin to remove the H1 format from the WordPress TinyMCE editor. | |
* Version: 1.0.0 | |
* Author: Jo Waltham | |
* Author URI: http://calliaweb.co.uk/ | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
// Exit if accessed directly | |
defined( 'WPINC' ) or die; | |
include plugin_dir_path( __FILE__ ) . 'includes/class-remove-h1-format.php'; | |
$remove_h1_format = new Remove_H1_Format; | |
add_filter( 'tiny_mce_before_init', array( $remove_h1_format, 'remove' ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment