Switch between Visual and HTML tab freely

So this question has been raised many times under different flags, however I’d like to present a unified thread for an ultimate solution to this issue. In WordPress, by default, when switching back and forth between the HTML and Visual editors in TinyMCE, certain tags are stripped out of content, and other weird functionality occurs. … Read more

Extra TinyMCE editor strips and tags?

Hey guys, I’ve added a TinyMCE to some textareas that are displayed in a custom meta box. All of the formatting works perfectly fine, except that the editor will not save <p> or <br/> tags. It doesn’t preserve the line breaks. The TinyMCE is setup like this: wp_tiny_mce(true, array(‘editor_selector’ => $field[‘class’] ) ); ‘<textarea name=”‘, … Read more

Adding Custom Text Patterns in the WP 4.5 Visual Editor

4.5 is out and with it new Text Patterns. I would like to know how to go about adding my own custom patterns. Taking a look at wp-includes/js/tinymce/plugins/wptextpattern/plugin.js it seems pretty straight forward. var spacePatterns = [ { regExp: /^[*-]\s/, cmd: ‘InsertUnorderedList’ }, { regExp: /^1[.)]\s/, cmd: ‘InsertOrderedList’ } ]; var enterPatterns = [ { … Read more

How do I include a TinyMCE editor in the frontend?

I am trying to add a TinyMCE editor in my frontend from where users can post but have had no luck so far. Here is the code: PHP: add_action(‘wp_print_scripts’, ‘my_enqueue_scripts’); function my_enqueue_scripts() { wp_enqueue_script( ‘tiny_mce’ ); if (function_exists(‘wp_tiny_mce’)) wp_tiny_mce(); } Javascript: jQuery(document).ready(function(){ tinyMCE.init({ mode : “textareas”, theme : “simple”, /*plugins : “autolink, lists, spellchecker, style, … Read more

Disable emojicons introduced with WP 4.2

So WP 4.2 introduced emojis (smileys) that basically adds JS and other junk all over your pages. Something some people may find shocking. How does one completely erase all instances of this? We will hook into init and remove actions as followed: function disable_wp_emojicons() { // all actions related to emojis remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ ); … Read more