[wp-trac] [WordPress Trac] #31065: Shortcode without closing tag

WordPress Trac noreply at wordpress.org
Tue Jan 20 05:03:42 UTC 2015


#31065: Shortcode without closing tag
--------------------------+-----------------------------
 Reporter:  rilwis        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Shortcodes    |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi,

 I've just found a bug with shortcodes when developing my theme. The
 problem is if we put 2 instances of a shortcode next to each other, one
 without closing tag, one with closing tag, then they don't work as
 expected.

 This is sample code:

 {{{
 add_shortcode( 'test', 'rw_test' );

 function rw_test( $atts, $content )
 {
         $atts = shortcode_atts( array(
                 'name' => 'WordPress',
         ), $atts );

         return $atts['name'];
 }

 echo do_shortcode( '[test][test name="Anh"][/test]' );
 }}}

 The expected result is "WordPressAnh", but it displays only "WordPress".

 I think the regular expression has a bug here, but it looks too
 complicated to me so I hope someone can join and fix this bug.

 Thanks.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31065>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list