Simply copying and pasting from google docs into wordpress adds tons of this: <span style="font-weight: 400px"> throughout the wordpress post/page.

2 Answers 2


You can avoid such behaviour in many different ways.

Solution 1:
You can use the Paste as text option

enter image description here

Solution 2:
Instead of using the Visual editor switch to the Text editor.

Solution 3:
A third alternative would be to use the Clear formatting option after pasting your text.


Found that the issue is TinyMCE. Here is a solution that prevents the spans from being added on paste: https://bionicteaching.com/clean-google-doc-cut-paste-into-wordpress-editor/

Add this to functions.php:

//fix cut paste drama from https://jonathannicol.com/blog/2015/02/19/clean-pasted-text-in-wordpress/

 * Customize TinyMCE's configuration
 * @param   array
 * @return  array
function configure_tinymce($in) {
  $in['paste_preprocess'] = "function(plugin, args){
    // Strip all HTML tags except those we have whitelisted
    var whitelist = 'p,b,strong,i,em,h2,h3,h4,h5,h6,ul,li,ol,a,href';
    var stripped = jQuery('<div>' + args.content + '</div>');
    var els = stripped.find('*').not(whitelist);
    for (var i = els.length - 1; i >= 0; i--) {
      var e = els[i];
    // Strip all class and id attributes
    // Return the clean HTML
    args.content = stripped.html();
  return $in;
  • Welcome. Why use a full length script when there are so many other much simpler alternatives?. Furthermore the script is restrictive in the sense that you can NOT just go back and forth. Once placed it will prevent you from ever changing the behaviour (unless deleted). Commented Jan 23, 2020 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.