[wp-hackers] disabling wpautop

Kevin Newman CaptainN at unFocus.com
Wed Mar 16 20:23:31 UTC 2011

Hi there,

I want to kill off wpautop using a plugin.

It looks like this may be all I need to do this on the server side:

remove_filter ('the_content',  'wpautop');
remove_filter ('comment_text', 'wpautop');

But the place it's most annoying, is in the editor. Even the server side 
autop is not so bad, because if you use <p> in the text field, it pretty 
much leaves them alone - but if you do something like go to another 
page, switch to Rich Text mode, then go back and edit a page you set 
carefully with wpautop incompatible html code, it decimates everything 
without asking questions. Hence my quest to, as Chris Rock might say, 
turn that shit off.

Ok, so it looks like the offensive JS is this:

     pre_wpautop : function(content) {
         var t = this, o = { o: t, data: content, unfiltered: content };

         jQuery('body').trigger('beforePreWpautop', [o]);
         o.data = t._wp_Nop(o.data);
         jQuery('body').trigger('afterPreWpautop', [o]);
         return o.data;

     wpautop : function(pee) {
         var t = this, o = { o: t, data: pee, unfiltered: pee };

         jQuery('body').trigger('beforeWpautop', [o]);
         o.data = t._wp_Autop(o.data);
         jQuery('body').trigger('afterWpautop', [o]);
         return o.data;

My first thought was to just overwrite those functions with compatible 
functions that don't actually do the wpautop thing - but maybe it would 
be better to actually use those hooks. This is the point of this post.

What is the right way to disable this part of wpautop?


Kevin N.

PS If you are interested, the plan is to add an option per post to 
disable wpautop, rather than going all nuclear.

More information about the wp-hackers mailing list