TinyMCE – Add class to OL – selector doesn’t seem to get parent OL,UL, just LI’s (4.6.3)

I figured this out! I ended up running across this page today searching for something else and thought, THIS IS IT. I needed this property ‘selector’, because it seems like that guides what the selection should be targeting so I changed ‘block’ => ol to ‘selector’ => ‘ol’. function bb_mce_before_init_insert_formats( $init_array ) { $style_formats = … Read more

Easy way to inject js in tinymce iframe?

WordPress injects its own external script files in the TinyMCE editor iframe, see for example the wp-includes/js/tinymce/plugins/wpembed/plugin.js file: (function ( tinymce ) { ‘use strict’; tinymce.PluginManager.add( ‘wpembed’, function ( editor, url ) { editor.on( ‘init’, function () { var scriptId = editor.dom.uniqueId(); var scriptElm = editor.dom.create( ‘script’, { id: scriptId, type: ‘text/javascript’, src: url + … Read more

tinyMCE duplicates previous block element when pressing return (visual editor)

I’m currently having the same problem. Here’s my work-around. add_filter( ‘tiny_mce_before_init’, ‘workaround’ ); public function workaround( $in ) { $in[‘force_br_newlines’] = true; $in[‘force_p_newlines’] = false; $in[‘forced_root_block’] = ”; return $in; } tiny_mce_before_init gives you access to the TinyMCE settings that WordPress’ editor uses. See also: TinyMCEConfiguration The downside to this is instead of “return” resulting … Read more

Remove ‘Visual’ tab from TinyMCE editor

I can think of three way you can do this Log in to the Admin Control Panel and go to: Users -> All Users Find your username and click on Edit. Check “Disable the visual editor when writing” Add this code in the themes function.php file add_filter( ‘user_can_richedit’ , ‘__return_false’, 50 ); Install a plugin … Read more