|How to Switch by Default the WordPress Editor to HTML|
Exthemes Dev Blog – The default WordPress Editor WYSIWYG is great for ordinary posts and even for some simple code. However, it can seriously break the formatting of your article if you’re copy pasting stuff from elsewhere. Even though WordPress does a pretty good job of converting elements like headings, bullet points and tables from other formats, it still imperfect and you might find yourself having to repeatedly reformat content.
One way to ensure that your writers don’t create formatting problems is by making them type or paste their content into the “Text” portion of the WordPress editor. This way, you can be sure that there will be no special characters or formatting goof ups. It’s easy to ask your writers to switch to textmode before starting. But what if you want to make it the default instead? Why not reduce the chances of error and simply do it for them rather than risk having them forget? In this article, we take a look at how to switch the default WordPress editor to HTML instead of the standard visual interface.
Let’s take a look at how to do this globally, and then I’ll give you the code for implementing it only for specific roles.
Changing the WordPress Editor to HTML Globally
When you start writing a post with WordPress, it displays the visual editor by default for new posts and remembers your preference for individual ones so you can see in the screenshot below that the “Visual” tab is activated for my new test post.
The visual editor certainly has its uses and you don’t want to remove that capability entirely. Moreover, this is an extremely use a specific solution and isn’t scalable. You need to repeat this process for each new user you create. Instead of that, let’s write some code to merely switch the default style to text. Open up your functions.php file and paste the following code before your closing ?> PHP tag: