Remove formatting when pasting text by default

When pasting text into the WordPress classic editor, the default behavior is to keep the formatting of the pasted content. The keeps things like links working, but it also keeps font colors, sizes, and other formatting that may be undesirable.

To change the default behavior so that by default all formatting is removed, we can simply use the following lines of code:

add_filter( 'tiny_mce_before_init', function ( $mce_init ) {
    $mce_init['paste_as_text'] = true;
    return $mce_init;

This works with the Classic Editor plugin, with Beaver Builder, and potentially other plugins that make use of the WordPress implementation of TinyMCE.

Leave a Comment

Your email address will not be published. Required fields are marked *