How to get WP editors tinyMCE instances

If you wait for the SetupEditor event then you can access the editors: add_action( ‘admin_print_footer_scripts’, function () { ?> <script type=”text/javascript”> jQuery(function ($) { if (typeof tinymce !== ‘undefined’) { tinymce.on(‘SetupEditor’, function (editor) { if (editor.id === ‘contentLeft’) { // Could use new ‘input’ event instead. editor.on(‘change keyup paste’, function (event) { console.log(‘content=%s’, this.getContent()); }); … Read more

TinyMCE Autoresize

Here’s a solution. There’s a slight problem as it does not recognize when images are added to the editor. 1: Create a folder with the name tinymce-autoresize in the plugins folder. 2. Create a file in tinymce-autoresize named tinymce_autoresize.php with this content: function intialize_autoresize_plugin() { // Check user permission if ( ! current_user_can(‘edit_posts’) && ! … Read more

How to remove_filter that filters iframes in posts? [duplicate]

This filter does not. This feature is disabled in the visual editor TinyMCE. function wpse49619_change_mce_options($initArray) { $ext=”iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src]”; if ( isset( $initArray[‘extended_valid_elements’] ) ) { $initArray[‘extended_valid_elements’] .= ‘,’ . $ext; } else { $initArray[‘extended_valid_elements’] = $ext; } // maybe; set tiny paramter verify_html //$initArray[‘verify_html’] = false; return $initArray; } add_filter(‘tiny_mce_before_init’, ‘wpse49619_change_mce_options’); Also you can use examples … Read more

Remove tinyMCE from admin and replace with textarea

No need to reinvent the wheel – put your editor support back and tweak the settings: function wpse_199918_wp_editor_settings( $settings, $editor_id ) { if ( $editor_id === ‘content’ && get_current_screen()->post_type === ‘custom_post_type’ ) { $settings[‘tinymce’] = false; $settings[‘quicktags’] = false; $settings[‘media_buttons’] = false; } return $settings; } add_filter( ‘wp_editor_settings’, ‘wpse_199918_wp_editor_settings’, 10, 2 );

TinyMCE removes iframe attributes width and height

[*] This took me ages to figure out but here is how it works now just add below code to the functions: function tinyMCEoptions($initArray) { $options=”*[*]”; $initArray[‘valid_elements’] = $options; $initArray[‘extended_valid_elements’] = $options; return $initArray; } add_filter(‘tiny_mce_before_init’, ‘tinyMCEoptions’); [*]