Answer the question
In order to leave comments, you need to log in
How to remove styles when copying text in tinymce wordpress?
Goodnight. Strictly speaking subject. I tried almost everything, but when copying text from the site, tinymce still pulls up the styles. The filter now stands with the following settings:
function my_format_TinyMCE( $in ) {
global $post;
$post_type = get_post_type( $post->ID );
if( $post_type == 'pubedit'){
$in['remove_linebreaks'] = false;
$in['gecko_spellcheck'] = false;
$in['keep_styles'] = false;
$in['accessibility_focus'] = false;
$in['tabfocus_elements'] = 'major-publishing-actions';
$in['media_strict'] = false;
$in['paste_remove_styles'] = true;
$in['paste_remove_spans'] = true;
$in['paste_strip_class_attributes'] = 'none';
$in['paste_text_use_dialog'] = false;
$in['wpeditimage_disable_captions'] = true;
$in['plugins'] = 'wordpress,wplink';
//$in['content_css'] = get_template_directory_uri() . "/editor-style.css";
$in['wpautop'] = true;
$in['apply_source_formatting'] = false;
$in['block_formats'] = "Paragraph=p";
$in['toolbar1'] = 'bold, italic, underline, strikethrough, link, unlink';
$in['toolbar2'] = '';
$in['toolbar3'] = '';
$in['toolbar4'] = '';
return $in;
} else {
$in['toolbar1'] = 'bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv ';
$in['toolbar2'] = 'formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help ';
$in['toolbar3'] = '';
$in['toolbar4'] = '';
return $in;
}
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );
Answer the question
In order to leave comments, you need to log in
Still solved the problem. Even I completely forgot to connect the tinymce paste plugin.
As a result, it is enough to make the following settings:
function my_format_TinyMCE( $in ) {
$in['keep_styles'] = false;
$in['paste_remove_styles'] = true;
$in['paste_remove_spans'] = true;
$in['paste_as_text'] = true;
$in['plugins'] = 'wordpress,wplink,paste';
return $in;
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question