Simple wordpress function to enable paste as text automatically in the editor, easy way to enable paste as plain text without plugin.

Paste As Text

Activate “Paste as text” button is tired every time you want to write post! but don’t worry, we will give you simple wordpress function to enable this buttonĀ automatically in the editor. UsingĀ tiny_mce_before_init filter and teeny_mce_before_init filter, we will enable button.

Function

Copy function code and paste it in your functions.php file, function code:

function WPTime_paste_as_plain_text($init){

    global $tinymce_version;

    if ( $tinymce_version[0] < 4 ) {
        $init[ 'paste_text_sticky' ] = true;
        $init[ 'paste_text_sticky_default' ] = true;
    }
    else{
        $init[ 'paste_as_text' ] = true;
    }

    return $init;

}
add_filter('tiny_mce_before_init', 'WPTime_paste_as_plain_text');
add_filter('teeny_mce_before_init', 'WPTime_paste_as_plain_text');

paste as plain text wordpress

Enjoy.