WordPress Gallery Shortcode with No Image Link
I was a little surprised today when I discovered that the wordpress shortcode for “gallery” had no option to have the images be no link at all, either fixed to “File” or “Attachment Page”. I’m not a fan of editing the core PHP, but this is definitely a wordpress shortage. Bummer about this hack is that if you upgrade WordPress, it’ll likely overwrite this change, but hey, my blog will still be here for ya. Here’s how to enable gallery link=’none’ to work:
UPDATE – No more changing WordPress Core Files! Let’s get smarter here. This is now a PLUGIN! Install by going to Plugins > Add New > search for “Gallery with No Image Links”
Whala – now you can use gallery link=”none” and the images not be forced linked to something.
Find this useful? Take just a moment and give a $1. Thanks!












Sators reply on April 28th, 2010:
Well, I haven’t tested this, but I would look just a few lines down at 770 where you see wptexturize($attachment->post_excerpt). That’s the comment being injected…so maybe test throwing in your apply_filter around there…let me know what you come up with!
[Reply]
deschamps_24 reply on April 29th, 2010:
Thanks for the idea! I would not have thought of this, but I guess this just shows that I do not completely understand the workings of the gallery. Caption as post excerpt?
Anyway, I replaced the code you suggested with:
apply_filters(‘the_excerpt’, wptexturize($attachment->post_excerpt))
and it works like charm! So I managed to make my image gallery multi-lingual!!! Thank you!
[Reply]