Why did my get mangled, and how can I keep from happening again?

This is a known bug with TinyMCE. That is the standard text editor in WP. When you hit refresh whilst editing a page it adds those tags to javascript. https://github.com/tinymce/tinymce/commit/5f320ac2acda15902b0488df1b7d85bf5c24ef94 However it is marked as fixed some time ago (2015) so perhaps your site is not up to date? Or of course perhaps it has … Read more

add button to tinymce

Your method is complex… Here is simplest function to add BUTTON in TinyMCE: (insert this code in funcitons.php): add_action(‘admin_init’, function() { if (current_user_can(‘edit_posts’) && get_user_option(‘rich_editing’) == ‘true’) { add_filter(‘mce_buttons_2’, ‘register_buttonfirst’); add_filter(‘mce_external_plugins’, ‘add_pluginfirst’); } }); function register_buttonfirst($buttons) { array_push($buttons, “|”, “shortcode_button1” ); return $buttons;} function add_pluginfirst($plugin_array) {$plugin_array[‘MyPuginButtonTag’] = plugin_dir_url( __FILE__ ).’My_js_folder/1_button.php’;return $plugin_array;} add_filter( ‘tiny_mce_version’, ‘my_refresh_mceeee1’); function … Read more

How do I change TinyMCE button “i” to create a i tag rather than em? [duplicate]

Here’s a simple function that will replace <em> with <i> on your post/page: function replace_em_with_i($content) { $content = str_replace(‘<em>’, ‘<i>’, $content); $content = str_replace(‘</em>’, ‘</i>’, $content); return $content; } add_filter(‘the_content’, ‘replace_em_with_i’); Warning: I have tested the code to check if it works (and it does work), but you might want to do some serious testing … Read more

Add new MCE button for toggle specific cell background color

I have found a great tutorial about making a custom button to the tinymce. http://qnimate.com/adding-buttons-to-wordpress-visual-editor/ You can just follow this guide and copy all of it. Don’t forget to activate your new plugin in the plugin menu (in admin panel). Then you can just change the code inside index.js and especially in the ed.addCommand(“green_command”, function() … Read more