If you're managing a blog with multiple authors, or you just want to keep on…
wpautop is a WordPress function which automatically changes line breaks made in your WYSIWYG editors to <p> or <br> HTML tags. This is useful for most purposes, but if you are switching back and forth between the visual and text editors, it may be useful to disable it on a post by post basis. Toggle Wpautop gives you a simple toggle switch that lets you flip it off whenever you want.
What’s It Do?
If you’re still confused about what the wpautop function does, just imagine you have typed this into your visual editor on a post:
I love muliple lines sometimes
The actual HTML that will be output is:
<p>I love</p> <p>multiple lines</p> <p>sometimes</p>
If you have ever switched back and forth between the visual and HTML editor and noticed that your format is a little different, this is because of the wpautop filter. It’s possible to remove this at a global level with a fairly simple filter:
remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' );
But most of the time, you will want to leave it intact. Toggle Wpautop puts a checkbox in the “Publish” meta box of your posts and pages labeled “Disable wpautop”. If you check this box, then <p> and <br/> tags will not be added to your posts, and if there is a new line, only non-breaking spaces will be added. This should be able to fix most formatting issues that you have. The plugin also has a setting to disable certain post types from having the checkbox included if you want to remove this feature and keep wpautop intact.
How’s It Work?
When you install and activate wpautop, you will notice a new checkbox on all of your posts and pages, in the top-right “Publish” box labeled “Disable wpautop.” All you have to do is check this box and the wpautop filter will be completely removed. If you check this box, update your post, then switch back and forth between your visual and text editor with multiple line breaks, you will see the plugin in action. There’s nothing else to set up and wpautop will still be enabled on all posts by default. It is simply there if you wish to remove it on a post by post basis.
If you visit Settings -> Writing you will also see a new Toggle Wpautop section. This section will have a list of post types that are included in your WordPress install, including posts, pages and any custom post types you have set up. If you wish to remove the “Disable wpautop” altogether from any post type, simply uncheck the box and click “Save Changes.”
This will keep the wpautop filter enabled for all posts, and editors will not have the option to switch it off. This is especially useful for custom post types or other plugins which may rely on this filter for formatting to work.
Costs, Caveats, Etc.
This plugin filters content before HTML is generated, so there are no performance consequences, and I haven’t yet had a problem with it. Updates may come from time to time, but it mostly will stay the same. If you are having a problem, however, you can visit the support forums and ask for help.