Support » Fixing WordPress » Href missing in image links

  • Hi,

    When inserting images (Add Media) the href tag is no longed part of the link, which should look like this:
    <a href="https://www.ross.no/wp-content/2021/06/20210625-DSC_1702-1-4.9-scaled.jpg"><img class="alignnone size-medium wp-image-196476" src="https://www.ross.no/wp-content/2021/06/20210625-DSC_1702-1-4.9-700x466.jpg" alt="Fiskemåke – Mew gull (Larus canus)" width="700" height="466" /></a>

    Instead it’s now just this:
    src="https://www.ross.no/wp-content/2021/06/20210625-DSC_1702-1-4.9-700x466.jpg" alt="Fiskemåke – Mew gull (Larus canus)" width="700" height="466" /></a>

    This means that images are no longer clickable and zoomable – only the featured image – of the post.

    This post is how it should be working: https://www.ross.no/2021/06/25/fiskemake-mew-gull-larus-canus-22/

    I have noticed this has happened intermittently in past years after I did an audit on my site’s more than 4k posts and 7k images, but they were just a handful.

    Last time this worked was in July, and I haven’t created any new posts since then.

    WP is 5.8.3.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sébastien SERRE

    (@sebastienserre)

    Hello,

    IMO, this is not WP related. Front-end is managed by themes.
    Showing a image in HTML is : <img class="alignnone size-medium wp-image-196476" src="https://www.ross.no/wp-content/2021/06/20210625-DSC_1702-1-4.9-700x466.jpg" alt="Fiskemåke – Mew gull (Larus canus)" width="700" height="466" />

    It seems your theme doesn’t chose to add a link around it.

    • This reply was modified 4 months ago by Sébastien SERRE. Reason: correct typo
    Thread Starter Morten Ross

    (@rosmo01)

    I have a mirror/staging site where this is not present, nor possible to reproduce, so there is a condition that occurs which resets this, but I don’t know what that condition is. On live site I’ve had to add

    //The picture is connected to the media file by default (original link) 
    update_option ( 'image_default_link_type' ,  'file' ) ;

    to the functions.php to force the setting to link image to file. But as I don’t have this in functions.php for staging site it points out an inconsistency in the enforcement this particular setting.

    I’ve found several posts regarding this that point to the default behavior of linking to image is not static. There are many scenarios with linking to image that point to an underlying issue with fully controlling the setting to always using link to file.

    25578, 15865

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.