Add a TinyMCE Core Plugin Using tiny_mce_before_init

Sorry to answer my own question, but of course I figured it out right after posting this. Instead of tiny_mce_before_init I needed to use mce_external_plugins. Also, I had to download TinyMCE from their website and copy the plugins/advlist folder to WordPress. I created a folder called mce in my WordPress plugins directory and pasted the … Read more

Stop WordPress Visual Editor converting backticks into code blocks

This has solved the problem, simply remove the plugin which automatically formats text as you type, from loading in the first place. add_filter( ‘tiny_mce_plugins’, ‘rwebster_editor_remove_wptextpattern’, 1, 99 ); function rwebster_editor_remove_wptextpattern( $plugins ) { $wptextpattern = array_search( ‘wptextpattern’, $plugins ); unset( $plugins[$wptextpattern] ); return $plugins; }

How to reset ‘Advance’ tab on table property?

To customize default styles: $styles = array(‘width’=>’100%’); $settings[‘table_default_styles’] = json_encode($styles); To disable advance tab: $settings[‘table_advtab’] = false; Complete code at functions.php: function bootstrap_classes_tinymce($settings) { // to customize more please visit: https://www.tiny.cloud/docs/plugins/table/#table_default_styles // Add bootstrap class inside <table> tag $classes = array( array( ‘title’ => ‘None’, ‘value’ => ” ), array( ‘title’ => ‘Table’, ‘value’ => … Read more

TinyMCE 4.7.11 custom styles using styleselect – what does the ‘attributes’ argument do?

I’m not sure this is even the intended use for the argument Yes, it is. Use the attributes option to add HTML attributes (e.g. class, title, etc.) to the generated or target element (e.g. span). So based on your example: array( ‘title’ => ‘Link Resource’, ‘selector’ => ‘a’, ‘classes’ => ‘smart-link-external smart-link-resource’, ‘wrapper’ => false, … Read more

wp.editor.initialize does not show the same default toolbar

Please Add this code for same layout for wp wp.editor.initialize(editor_id,{ tinymce: { wpautop: true, plugins : ‘charmap colorpicker hr lists paste tabfocus textcolor fullscreen wordpress wpautoresize wpeditimage wpemoji wpgallery wplink wptextpattern’, toolbar1: ‘formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,spellchecker,fullscreen,wp_adv,listbuttons’, toolbar2: ‘styleselect,strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help’, textarea_rows : 20 }, quicktags: {buttons: ‘strong,em,link,block,del,ins,img,ul,ol,li,code,more,close’}, mediaButtons: false, });

Different css rules for TinyMCE and Gutenberg while using add_editor_style()

SHORT VERSION Using css it’s possible to use of the :not() selector to exclude Tinymce instances, e.g. body:not(.mce-content-body) {…} LONG VERSION Let’s assume we have declared theme support for editor styles and included an editor stylesheet somewhere in our theme (e.g functions.php) like this: add_theme_support( ‘editor-styles’ ); add_editor_style( ‘something/something/css/editor.css’ ); For the sake of this … Read more

TinyMCE Visual Blocks plugin set Show blocks option for all users

Just add this code to functions.php of your theme and then “View” –> “Show blocks” will always be enabled immediately when the page loads if( !function_exists(‘custom_settings_tinymce’) ){ function custom_settings_tinymce($init) { $init[‘visualblocks_default_state’] = true; return $init; } add_filter(‘tiny_mce_before_init’, ‘custom_settings_tinymce’ ); }