The WordPress Visual Editor on the Edit Post screen is sometimes a real menace as it adds some formatting and removes the ‘div’ elements and sometimes paragraphs and classes automatically. It also adds some invalid HTML or what we can say non-standard code to our post’s HTML source.
[ad id='7' style='float:left;margin:10px 10px 10px 0']Once I got exhausted adding a ‘div’ with certain class to a post thru HTML editor, and when I was switching to Visual editor that div would disappear. I was losing all my formatting. I just wanted that I could write HTML and then check the changes in ‘Preview Post’.
So in such cases, you definitely would want to disable the WordPress Visual Editor. There are two simple ways:-
1) Disable the Visual Editor for yourself (single user). This is comfortable and easy option in case you are the only one writing on your WordPress blog or you do not want to disable the Visual Editor for other users, just you want to leave on them whether they want to disable it or keep it ON.
2) Disable the Visual Editor completely, for all the blog users i.e. all your WordPress site’s authors, editors and contributors along with the admin will not see the Visual Editor. This would be a good option in case you run a multi author blog/site.
On the WordPress admin dashboard, go to Users => Your Profile =>In Personal Options => Tick the checkbox saying ‘Disable the visual editor when writing’. Have a look at the below screenshot:
Go to your active theme’s functions.php file (theme functions) => Paste the below one line of code and you are done
add_filter ( 'user_can_richedit' , create_function ( '$a' , 'return false;' ) , 50 );
When you paste this code in theme functions file, your visual editor will totally disappear. Refer the below screenshot:-
You can find the Theme Functions file on your WordPress Admin Dashboard => Appearance => Editor => On the right hand side you can see the theme template files. Locate the Theme Functions file, add the line and save it.
In case you do not have access to Theme Editor on dashboard, you can always use the FTP client to get the file, edit it and then upload to the server.