[wp-trac] [WordPress Trac] #12061: Treatment of shortcodes by wpautop is incomplete

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 28 02:27:18 UTC 2010


#12061: Treatment of shortcodes by wpautop is incomplete
--------------------------+-------------------------------------------------
 Reporter:  gcorne        |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  Shortcodes    |     Version:            
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 There are a number of issues that arise when shortcodes are embedded in a
 block of content that is filtered by wpautop.  After studying the issue, I
 have come to the conclusion that the underlying issue is that a shortcode
 can result in a block-level HTML element or an inline snippet of HTML.
 Neither wpautop nor shortcode_unautop have the information necessary to
 know what the intended to be block-level or text-level, which results in
 <br /> tags to appear in places where they were not intended and causes
 invalid markup when paragraphs are not closed properly.

 1) shorcodes when registered need to state the display type of the html
 that they return (inline or block).  In addition, the javascript version
 of filters need to be provided with the same data.

 2) An alternate mechanism for handling shortcodes prior to wpautop needs
 to be implemented.   To maintain a separation between wpautop and
 shortcodes, temporarily replacing block-level shortcodes with unique
 tokens, running wpautop, running wpautop on the content of the shortcode
 (since this is a separate filter, plugins can disable it on a per
 shortcode basis), and then replacing the token with shortcodes post-
 wpautop.

 As WP and plugin authors use shortcodes more and more, I think this is an
 issue that should not be left to the wayside.  Shortcodes especially tied
 to tinymce buttons make working with WordPress easier for the average
 content producer.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12061>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list