Configure the default WordPress TinyMCE behaviour, defaults and buttons
<?php | |
defined( 'ABSPATH' ) or die(); | |
$lumpy_lemon_tiny_mce = new lumpy_lemon_tiny_mce; | |
class lumpy_lemon_tiny_mce { | |
function __construct() { | |
add_filter( 'mce_buttons', [ $this, 'buttons' ] ); | |
add_filter( 'mce_buttons_2', [ $this, 'empty_array' ] ); | |
add_filter( 'mce_buttons_3', [ $this, 'empty_array' ] ); | |
add_filter( 'mce_buttons_4', [ $this, 'empty_array' ] ); | |
add_filter( 'tiny_mce_before_init', [ $this, 'defaults' ] ); | |
} | |
function empty_array() { | |
return []; | |
} | |
function buttons( $buttons ) { | |
return [ | |
'removeformat', | |
'pastetext', | |
'formatselect', | |
'italic', | |
'bold', | |
'alignleft', | |
'aligncenter', | |
'alignright', | |
'bullist', | |
'numlist', | |
'blockquote', | |
'link', | |
'unlink' | |
]; | |
} | |
function defaults( $init ) { | |
$init['block_formats'] = 'Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3'; | |
$init['paste_as_text'] = true; | |
return $init; | |
} | |
} // class lumpy_lemon_tiny_mce |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment