[wp-trac] [WordPress Trac] #25415: magically (improperly!) inserted P tag

WordPress Trac noreply at wordpress.org
Fri Sep 27 02:03:56 UTC 2013


#25415: magically (improperly!) inserted P tag
-------------------------------------+------------------------------
 Reporter:  crysman                  |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Formatting               |     Version:  3.6.1
 Severity:  major                    |  Resolution:
 Keywords:  reporter-feedback close  |
-------------------------------------+------------------------------
Changes (by knutsp):

 * keywords:  reporter-feedback => reporter-feedback close


Comment:

 If your content is solely created by one or two shortcodes that expands to
 block level elements then you have no benefit from `wpautop()`.
 {{{
 remove_filter( 'the_content', 'wpautop' );
 }}}
 Then write a function that determines when you don't need this formatting,
 and returns accordingly:
 {{{
 function my_formatting( $content ) {
     if ( test-expression-here )
         return $content;
     else
         return wpautop( $content );
 }
 add_filter( 'the_content', 'my_formatting' );
 }}}

 I guess you will have to test for either post_type, post_format, category,
 post_tag or analyze the content to find out.

 Another way is to disable wpautop() manually on a post by post basis, with
 a plugin like this [http://wordpress.org/plugins/wpautop-control/]

 WordPress runs wpautop at priority 10 and shortcodes at priority 11
 (hence, after wpautop). It's possible to manipulate this order, bringing
 your specific shortcodes to run before wpautop. `wpautop()` will then see
 the html block level elements and leave them as they are, while allowing
 extra text to go into paragraphs
 [http://www.viper007bond.com/tag/wpautop/].

 Further on this matter is a support thing [http://wordpress.org/support/].
 This is not a bug.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25415#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list