[wp-trac] [WordPress Trac] #25405: The 'link' attribute not passed through shortcode_atts in the gallery shortcode callback

WordPress Trac noreply at wordpress.org
Tue Sep 24 08:23:44 UTC 2013


#25405: The 'link' attribute not passed through shortcode_atts in the gallery
shortcode callback
--------------------------+-----------------------------
 Reporter:  birgire       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Shortcodes    |    Version:  3.6.1
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 I was trying out the great new {{{shortcode_atts_gallery}}} filter on the
 {{{'link'}}} attribute to let {{{[gallery]}}} behave like {{{[gallery
 link="file"]}}} by default.

 Here is what I had in mind:
 {{{
     add_filter( 'shortcode_atts_gallery', 'my_gallery_atts', 10, 3 );
     function my_gallery_atts( $out, $pairs, $atts ) {
         if ( ! isset( $atts['link'] ) )
             $out['link'] = 'file';

         return $out;
     }
 }}}

 but this didn't work to my surprise. I checked the source and the reason
 seems to be that the {{{'link'}}} attribute is not passed through
 {{{shortcode_atts}}} for some reason, as you can see here:

 {{{
         extract(shortcode_atts(array(
                 'order'      => 'ASC',
                 'orderby'    => 'menu_order ID',
                 'id'         => $post ? $post->ID : 0,
                 'itemtag'    => 'dl',
                 'icontag'    => 'dt',
                 'captiontag' => 'dd',
                 'columns'    => 3,
                 'size'       => 'thumbnail',
                 'include'    => '',
                 'exclude'    => ''
         ), $attr, 'gallery'));

 }}}

 So I'm not sure why the default {{{'link' = ''}}} parameter is not listed
 there too.

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


More information about the wp-trac mailing list