Removing the TinyMCE editor for a given page template

You can try to hook on load-page hook instead of admin_init. It is supposed to be called only when a page is being edited, and then you should be able to use the global $post variable function hide_editor() { global $post; $template_file = get_post_meta($post->ID, ‘_wp_page_template’, true); if($template_file == ‘page-home.php’){ // template name here remove_post_type_support(‘page’, ‘editor’); … Read more

Prevent the Editor From Moving My  

It’s a simple solution/workaround, but a Shortcode could be used. As birgire noted, the whole anchor can be the Shortcode. And for ease of use, this article has a solution: adding a shortcode button in TinyMCE. You could have a dropdown with a selection of anchors, turning the fight in your favor 😉 WP editor … Read more

Adding html format on tinymce visual editor

I Googled wordpress mce filter, and it led me pretty directly to a TinyMCE Custom Styles tutorial on the Codex. It’s not a simple thing — you have to, for starters, enable a hidden button in TinyMCE called styleselect — but it looks like the tutorial is fairly complete. Is that what you’re looking for? … Read more

Localize variables with TinyMCE script

Looks as though Tiny MCE is not enqueued. Looks like it is loaded through the _WP_Editors class in class-wp-editor.php. There is a action hook in there called before_wp_tiny_mce where you can output a script with some localised variables… This is what I am going to do.

Fontawesome icon vanishes in editor while switching text and visual mode

I think you should first enable i tags.Then you should enable class id or span whatever you like.To do so add this code. function add_mce_markup( $initArray ) { $ext=”i[id|name|class|style]”; if ( isset( $initArray[‘extended_valid_elements’] ) ) { $initArray[‘extended_valid_elements’] .= ‘,’ . $ext; } else { $initArray[‘extended_valid_elements’] = $ext; } return $initArray; } add_filter( ‘tiny_mce_before_init’, ‘add_mce_markup’ );

Editor stripping out data attribute when saving

The “Text” editor is not an HTML editor. If you want to be able to edit raw HTML you will need to use some other editor, but that will probably limit your ability to use the visual editor for the content edited with it. The plugin you mentioned seems like good compromise. The other alternative … Read more

Multiple TinyMCE editors in dynamically generated textareas

The second parameter to wp_editor is the value that the “id” attribute of the textarea element will have, and that is probably why there are such restrictions on it. By default it is also used for the “name” attribute but you can set it explicitly by using the $settings parameter to wp_editor wp_editor($ID, ‘media_desc_n’,array(‘textarea_name’ => … Read more