How to disable formatting

Please use this code in your functions.php function tinymce_paste_as_text( $init ) { $init[‘paste_as_text’] = true; return $init; } add_filter(‘tiny_mce_before_init’, ‘tinymce_paste_as_text’); For details please follow link : This will paste copied text in plain format

Add Wrapper with Class to WYSIWYG Editor

Here’s the approach that I use. I add a single class (typically .entry-content) to the WP Editor on the back end as well as to the wrapper element when I output content on the front end. style.css .entry-content h2 { color: purple; } /* etc … */ I’m also using add_editor_style() to load my theme’s … Read more

Limit Block format tags in WordPress wp_editor

You need to add formatselect in one of the toolbars, and WordPress by default have it in toolbar1: wp_editor( $content, ‘fm_display_callback’, array( … ‘tinymce’ => array( ‘toolbar1’ => ‘formatselect,bold,italic,…’, … ), ) ); Check this and https://www.tiny.cloud/docs-4x/configure/content-formatting/#block_formats.

When adding buttons to the tinyMCE editor, how do I make them wrap to the next line and/or display in the “Kitchen Sink” area?

I imagine you’re also adding a filter mce_buttons to add in the button to, something like.. add_filter( ‘mce_buttons’, ‘add_my_tinymce_buttons’ ); function add_my_tinymce_buttons( $items ) { $items[] = ‘your-button’; return $items; } Just change the filter to hook onto mce_buttons_2 instead, and the button will appear on the second row , eg.. add_filter( ‘mce_buttons_2’, ‘add_my_tinymce_buttons’ ); … Read more

Limiting allowed html elements/strip harmful scripts from editor

Adjust HTML-Filter: <?php function fb_change_mce_options($initArray) { // Comma separated string od extendes tags // Command separated string of extended elements $ext=”pre[id|name|class|style],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’, ‘fb_change_mce_options’); ?> … Read more

Add TinyMCE to CPT metaboxes in 3.1?

Use this class: http://www.deluxeblogtips.com/p/meta-box-script-for-wordpress.html and then call the metabox like this (don’t forget to read the manual and view some examples): $meta_boxes[] = array( ‘id’ => ‘textmetabox’, ‘title’ => ‘Your Meta Box Title’, ‘pages’ => array(‘post’, ‘slider’, ‘whatever-your-cpt-is’), ‘fields’ => array( array( ‘name’ => ‘Your thoughts about Deluxe Blog Tips’, ‘id’ => $prefix . ‘thoughts’, … Read more

Set WordPress TinyMCE Editor To Readonly

You can hook into tiny_mce_before_init to modify the TinyMCE arguments to set the readonly attribute. For example (using PHP 5.3): add_filter( ‘tiny_mce_before_init’, function( $args ) { // do you existing check for published here if ( 1 == 1 ) $args[‘readonly’] = 1; return $args; } ); This will make the TinyMCE readonly, however it … Read more