-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathtinymce-editor.php
37 lines (31 loc) · 1018 Bytes
/
tinymce-editor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Set default editor mode to 'html', 'tinymce' or 'test'
*
* @link https://developer.wordpress.org/reference/hooks/wp_default_editor/
*/
add_filter( 'wp_default_editor', 'html' );
/**
* Disable rich/visual editor
*
* @link https://developer.wordpress.org/reference/hooks/user_can_richedit/
*/
add_filter( 'user_can_richedit', '__return_false', 50 );
/**
* Change default TinyMCE WYSIWYG settings.
*
* @link https://codex.wordpress.org/TinyMCE
* @link https://www.tiny.cloud/docs-4x/general-configuration-guide/basic-setup/#toolbarmenuconfiguration
* @link https://developer.wordpress.org/reference/hooks/tiny_mce_before_init/
*
* @param $settings Object Array of TinyMCE settings
*/
add_filter(
'tiny_mce_before_init',
function ( $settings ) {
$settings['toolbar1'] = 'formatselect,bold,italic,bullist,numlist,link,underline';
$settings['toolbar2'] = '';
$settings['block_formats'] = 'Paragraph=p; Heading 1=h1; Heading 2=h2; Heading 3=h3;';
return $settings;
}
);