Image links to page for no reason

  • I am working on a page for my blog. On that page, which is still in draft, I created a hyperlink to an image in the blog library. The link is set to open the image in a new tab. So far, so good.

    When that link is clicked and the image opens, however, the image is linked to another unrelated page on the blog. If the image is clicked this other page opens.

    I did nothing whatsoever to create that linkage and I have no idea how or why this link came to exist, nor how to remove it. Seems like a bug to me.

    As a workaround I can put the image in a page and link instead to that page. This works as expected, but it doesn’t explain what is going on or how to fix when I link to the image directly.

    Any ideas?

    Thanks.

    The blog I need help with is: (visible only to logged in users)

  • Hi,

    When that link is clicked and the image opens, however, the image is linked to another unrelated page on the blog. If the image is clicked this other page opens.

    Could you send a link to the post you’re having trouble with? If it’s still in draft, let us know which site and what the title of the post is. We’ll check it out and point you in the right direction for support.

    Please note these forums are for the sites hosted and managed here at WordPress.com. For help with a site hosted somewhere else, you’ll need to use the forums for self-managed WordPress installations instead.

    WordPress.com vs. WordPress.org

  • Thanks.

    I don’t know what happened to that page but I created another and the same problem occurs. The page is in draft at
    https://russontheroad.wordpress.com/?page_id=5556

    That draft page has one word on it, “Link” which is linked to a photo in my media library via a shortlink:
    091112_D7K_japanese-anemone_stack14c_1200
    That image of Japanese anemones has been published.

    When you click on the word Link on the draft page it opens the image of the Japanese anemones, but here is where things go awry–that image of the anemones is linked to another image https://russontheroad.wordpress.com/henry_cowell__d7k7273_4_5_fused_c-2/
    and for no reason I can tell. The image in the library is not linked to anything. I don’t think there is even any way you can link a photo in the library to something else, but it sure enough is.

  • Okay, so that “link” is not linking to the image in the media library.

    The media library URL of that image is https://russontheroad.files.wordpress.com/2020/05/091112_d7k_japanese-anemone_stack14c_1200.jpg

    What you’re linking to is the media attachment page for the image, https://russontheroad.wordpress.com/091112_d7k_japanese-anemone_stack14c_1200/

    The WordPress software automatically creates an attachment page every time you add an image to a post or page, and is essentially a separate page on your site just for that image. What’s happening here is that clicking on the image in the attachment page, causes another image’s attachment page to load.

    If you want people to be able to get to the full-size image from the post where you publish an image, you need to use the media file URL, not the attachment page URL. That’s how it’s set up in your most recent published post, https://russontheroad.wordpress.com/2020/05/05/mexican-or-devils-hand-tree/

    When inserting an image, you can also add that link directly to the image from within the editor:

    Insert the image block and upload your image. Then click on the image and click the link icon that should appear above the block. There you can pick between the media URL or the attachment page.

  • Thanks for trying to help but your are missing the point entirely.

    Clicking on the Japanese anemome photo links to https://russontheroad.wordpress.com/henry_cowell__d7k7273_4_5_fused_c-2/

    Why? That should not be. I did not create that link. I don’t want the flower to link to anything.

  • What @kokkieh is saying is indeed correct:

    What’s happening here is that clicking on the image in the attachment page, causes another image’s attachment page to load.

    When you click on the image, it takes you to the image’s attachment page. You’re right in that you did not create that link, it’s automatically generated, but you did select that option. Clicking on the image within the attachment page is what is taking you to

    Henry_Cowell__D7K7273_4_5_fused_c-HEADER

    This is happening because you are inserting the attachment page URL and not the media file URL – this is how attachment pages are set up to function. If you click on the next attachment page that you were taken to:

    cropped-henry_cowell__d7k7273_4_5_fused_c2.jpg

    It will take you to yet another attachment page:

    lane-assist_202273

    And it will continue to do that.


    @kokkieh
    mentions,

    If you want people to be able to get to the full-size image from the post where you publish an image, you need to use the media file URL, not the attachment page URL.

    So, add this media link to your post:

    And not this attachment link: https://russontheroad.wordpress.com/091112_d7k_japanese-anemone_stack14c_1200/

    As @kokkieh mentions,

    Insert the image block and upload your image. Then click on the image and click the link icon that should appear above the block. There you can pick between the media URL or the attachment page.

    If you open up your post and click media file and not attachment page, you will be good to go.

    Hope that helps. Let us know if you have any questions.

  • Thanks all for trying to help. I understand a little more, but still have problems with what’s going on. I understand I would have to link to the image URL and not the attachment page URL as I had done.

    What continues to befuddle me is why WordPress would automatically link the image of one image attachment page to another attachment page in an endless chain so that the entire media library can be clicked through as a slide show. I don’t see how that makes any sense. Is there any way to stop that?

    Above, DarnellDibbles wrote “When you click on the image, it takes you to the image’s attachment page. You’re right in that you did not create that link, it’s automatically generated, but you did select that option. “. Umm…not to my knowledge. Where is that setting made?

  • You are definitely getting a better understanding. I’ll try to add more clarity, based on your more recent questions.

    Based on the example you created for us originally, there are two ways to hyperlink text to an image: you can link to the raw image file(Media File), or you can link to the image attachment page (Attachment Page).

    1. Raw image file (Media File) – when you link to this, the behaviour is to present you with the raw image in the browser window. This view will not present the image within your site’s active theme design (because it’s the raw image file).

    2. Image attachment page (Attachment Page) – when linking to this, the behaviour is to present the image on a page of your site which uses the theme design you currently have active (Twenty Fourteen in your case).

    This is where things have gotten confusing, and I’ll try to help clear that up.

    The image attachment page (#2 above) is its own page template in your theme. In your case, the Twenty Fourteen theme’s image attachment page has an additional function built into its code: when the image on the page is clicked, it will randomly load a new image attachment page from your media library. This cannot be disabled or altered. It’s designed into the code of the image attachment page.

    View this image in your media library: https://russontheroad.wordpress.com/wp-admin/upload.php?item=5566

    Now view this example: https://d.pr/i/IyPJTY

    There you see that #1 is the link to the raw image file (Media File).

    You also see #2 leads you to the image attachment page URL (Attachment Page).

    In the original example you created for us, you used #2. And, as expected, when you click on the image it loads a new random image attachment page.

    If you do not prefer this method, your next option is to try using #1, the raw image link (Media File).

    If neither of these options fit your needs, let us know the exact behaviour and look you are going for and we’ll try to speak to that next. :)

  • I believe I am now clear on how things work. The only thing I would wish for is that images on attachment pages did not link to others. I cannot imagine what the coders were thinking when that was built into Twenty Fourteen. It takes control away from the blogger and creates a circumstance that may be undesirable. If I wanted to link an image on an attachment page to another I could do that myself and choose which. That bit of programming was a mistake, IMHO.

    I have other issues/problems with image galleries but I think it would be appropriate for me to create another thread about that.

    Thanks very much to all that have assisted me here.

  • The topic ‘Image links to page for no reason’ is closed to new replies.