Opened 13 years ago
Closed 13 years ago
#25405 closed defect (bug) (duplicate)
The 'link' attribute not passed through shortcode_atts in the gallery shortcode callback
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.6.1 |
| Component: | Shortcodes | Keywords: | has-patch |
| Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (2)
Note: See
TracTickets for help on using
tickets.
Duplicate of #24979.