When inserting a gallery it adds the following shortcode:
I would like it to automatically add link=”file” as the last attribute, whenever a shortcode is added. Like so:
When inserting a gallery it adds the following shortcode:
I would like it to automatically add link=”file” as the last attribute, whenever a shortcode is added. Like so:
You must be logged in to post a comment.
You can hijack the shortcode handler and set the attribute to a value of your choice. Then call the native callback for this shortcode.
There is a new
shortcode_atts_{$shortcode}
filter in WordPress3.6
according to Mark Jaquith.You could use the
shortcode_atts_gallery
filter to force thelink='file'
attribute:when you have upgraded to
3.6
.You can check it out in
/wp-includes/shortcodes.php
from the Core-Trac-Trunk:http://core.trac.wordpress.org/browser/trunk/wp-includes/shortcodes.php#L316