[wp-trac] [WordPress Trac] #21158: different result when shortcode atribute without value

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 4 19:11:44 UTC 2012


#21158: different result when shortcode atribute without value
--------------------------+-----------------------------
 Reporter:  thomask       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Shortcodes    |    Version:  3.4
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 imagine those two shortcodes

 {{{
 [shortcode attribute]
 [shortcode attribute=value]
 }}}

 IMO they should have the same result, just the second should have some
 value to the attribute and the first should have NULL or false

 But if you do

 {{{
 add_shortcode( 'shortcode', 'my_shortcode' );
 function my_shortcode( $atts ) { print_r ($atts); }
 }}}

 the first shortcode results in

 {{{
 array (
   0 => 'attribute',
 )
 }}}

 while the second in

 {{{
 array (
   'attribute' => 'value',
 )
 }}}

 I'm not sure, maybe it is intentional, i have not found any description,
 what should shortcode attribute without value do. But imo it should work
 as i have described as it is the only way how it could clear some
 predefined value (the only other way is to set it to empty string, which
 may not always be the same as NULL or FALSE).

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


More information about the wp-trac mailing list