I sometimes write dreictly in the WordPress editor. If I use another program it’s always Hemingway. It helps write better, more readable content. If you use other programs to write content before putting it into your WordPress website, the Paste As Text button should be your friend.
There is a huge problem with copying and pasting content into WordPress though. It copies underlying, invisible, and unnecessary code. In the image below, I pasted in some ForcemIpsum from Google Docs. You can see that it puts <span>
tags in there. We don’t want that. This can even make content look weird if your theme has styles those.
Microsoft Word is way worse with the code that it puts into your WordPress Editor.
When you copy and paste content into the WordPress editor, you need to make sure to click the Paste As Text button beforehand. This will paste it without any of the formatting and code.
Pasting content into #WordPress from other programs is messy. Let's fix it! Click To TweetPaste As Text By Default
Using a function to tie into the WordPress Editor, we can have the Paste As Text button selected by default. That way we’ll never forget to do it and the code that makes up our content will be clean.
Simply put the code below into your functions.php
file. If you’re using a child theme, use the My Custom Functions plugin and go to Tools > My Custom Functions.
Now, Paste As Text is selected automatically and you never get the funky, unwanted code from other programs.
More With The TinyMCE WordPress Editor
You can do a couple cool things with the WordPress editor. Adding a custom dropdown for styles allows you to wrap elements within the editor to make it easy for you and your clients to add certain elements.
Another detail to pay attention to is adding a custom stylesheet to the editor. Using the above technique and attaching a custom CSS file to the editor, you’ll be able to visually see the styles.
What do you think?
Do you have something to say about this post? Give us your opinion, insight, changes, or alternative way of doing something. We'd love to hear from you!
Frank f.j. van der Leer
This works great, strange that this is not an option in WP itself. Thanks!
Kevin Donnigan
Glad it worked for you! It’s a very convenient option that I think should be rolled into the WordPress core. They random, messy code that gets pasted into the editor from any program is maddening. But… here’s a simple solution I include in all of the websites I build.