Sometimes, we need to implement an external HTML code or specify HTML by design inside a WordPress page.
When we use the text editor of WordPress we have the option to do just that, but if we look closely on the HTML that is generated after the specific page is rendered, we can see some alteration to the code. Those alterations may cause a lot of problems if you build your design (CSS) by it. Usually, it comes to Ps that are added, page breaks or other unnecessary elements. Read more of a function tells WordPress to skip this parsing of the HTML and leave it intact.
Use this code snippet inside your theme’s function.php file
1 2 3 4 5 6 7 8 9 |
<? add_action('wp_head', 'remove_wpautop'); function remove_wpautop(){ $pages = array(123,456,1009); // here put a list a pages. if (is_page($pages)){ remove_filter('the_content', 'wpautop'); } } ?> |