Support » Fixing WordPress » (Urgent)how Link images to blog post in gallery.

  • my question is regarding the default or internal gallery of wordpress.

    is it possible to link individual images in a gallery to external website or blog post.

    for eg :
    what i want is ,to be able to link images to other sites within the gallery so that when readers click the image in gallery they are taken to external site and not the full image view or description page of that image.

    I tried doing this in gallery tab via ‘Link URL’
    but when i put the external url ,say
    and save and update gallery ,the image open the description page instead of

    Please help, my project has come to a standstill .

Viewing 11 replies - 1 through 11 (of 11 total)
  • I have the exact same problem as described above!

    It is so infuriating, why can’t anyone offer any explanation? It is so inconvenient for the gallery to link to the thumbnail image and not to the designated post or external weblink.

    When the link url of the post is entered on the image, when save or update gallery is applied the text entered disappears and the only link available is to open the thumbnail in a new window. Pointless!

    Can anyone please help with this request?

    Just tried it with version 3.0.1 and it works fine.

    What do you mean by description page?

    Thanks for your reply Joseph, can you describe what you did?

    What I want is to have a page displaying images I use on my posts but as thumbnails as a gallery (an extra archive page of sorts), so that when the thumbnail is clicked it opens up the post which has that image and text on it.

    I too have version 3.0.1 and when I insert a gallery on a page, the link url I enter on each image to link to the post is ignored so that when the page is uploaded and you click on the image within the gallery it only opens the thumbnail image and has lost the url link to the post.

    Any help is appreciated.


    Sorry, my mistake, I miss understood the problem.

    Link URL is for when inserting individual images and the gallery setting, link to image file or attachment page, overwrites it.

    You’ll need to either hack the core files or find a plugin.

    No problem Joseph.

    Does anyone know how to hack the core files or a plugin that can do what we are looking for?

    I have tried many plugins and cant find one that achieves this.

    Any help is very appreciated.


    I’m also trying to figure out a solution for this. I have my gallery all setup, but I need to link to pages on my WordPress site instead of the image file or attachment page.


    That’s exactly my problem, too. It seems that the default url is the url in the wp media library. I want a specific picture to go to a specific page on my WordPress site–not an external site.

    That was my problem also 🙂

    Unfortunately, there’s no way to change wordpress’ original behaviour. The alternative method, however, is quite simple: unset the original “URL” field and add a new, controllable, fashioned “URL” field.

    Write this code at your functions.php

    [Code moderated as per the Forum Rules. Please use the pastebin]

    To access it’s value, try:

    $custom_url = get_post_meta($post->ID, '_custom_link', true);

    It’s all about the right hook, people!

    Original idea from:

    @liperuf Thanks for the solution. Is the code in Pastebin expired? Nothing showed up for me. Also, I am not sure what to do with the $custom_url = get_post_meta($post->ID, '_custom_link', true);
    I appreciate any help ypu can give me. Thanks

    Sorry @decca1o. I forgot about pastebin bureaucracy.

    So, paste the code below in functions.php

    This piece of code unset original URL field and adds another metadata-URL field.

    Then, you need to hook the “saving” process aswell (also paste this in functions.php):

    And, finally, access it’s value width:

    $custom_url = get_post_meta($post->ID, '_custom_link', true);

    inside any Loop, where $post->ID is an attachment ID.

    I hope it helps!

    That does help. I appreciate it

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘(Urgent)how Link images to blog post in gallery.’ is closed to new replies.