WordPress Editor – disabling wpautop()

wpautop() The WordPress wpautop() function handles this aspect of Post/Page formatting. This function filters the_content() and the_excerpt() and, because it is a WordPress Filter, it’s very easy to disable it. Before you read the next section, just bear in mind what disabling wpautop() means. Firstly, you will need to manually add <p> and <br /> tags whenever you write a Post or Page from now on and, secondly and more importantly, you will need to go back into every existing Post and Page and manually add the <p> and <br /> tags. This is because the <p> and <br /> tags in your Posts and Pages are NOT saved in the database. The <p> and <br /> tags you currently see, when viewing Posts and Pages in the browser, are added by the wpautop() function between database and browser. (That’s why it is called a Filter, by the way. It “filters” whatever is passed through it – in this case the_content() and the_excerpt()). So, please bear this in mind before proceeding… Disabling wpautop() To disable wpautop(), just add this code to your theme’s functions.php file: //disable wpautop filter remove_filter ('the_content', 'wpautop'); That’s it! It really is that simple… Don’t forget to add the <p> and <br /> tags in HTML View in the Editor when writing Posts and Pages! And finally… Observant visitors will notice that some of my older posts look rather poorly formatted at the moment. That’s because having disabled wpautop() last week, I haven’t yet got around to re-editing all my...

Read More