All WordPress developers will know that the HTML editor inside WordPress is a complete joke. It rearranges everything, closes tags, and mangles all your code. This is due to 2 built-in WordPress modules, Auto P and Texturize. The 2 magical lines that will disable these modules and turn the HTML editor into a normal, functioning, pure HTML editor are these:
Open the theme’s functions.php file. Inside the PHP code, put:
remove_filter (‘the_content’, ‘wpautop’);
That’s it! By the way, to turn the Visual Editor off, go to your User Profile and click the checkbox at the top.