Support

Account

Home Forums General Issues images urls converting to https

Solving

images urls converting to https

  • Our site is hosted on WP Engine. We have an SSL certificate installed and currently have wp-admin and our login and register pages forced to https.

    We are having a bizarre issue with image urls in ACF fields. Any image added to an ACF field and saved as http saves as http, but then when the page reloads after the save, the url for the image has converted to https. If we open an existing post that has images, all the image urls are https, even if they were saved as http. So, if we save the post again, the image url is now saved as https and appears as a broken image on the site. This is problematic for a couple reasons, the biggest one being that we have to remember to change all the urls to http every time we edit a post, even if we’re not even editing the images.

    WP Engine has tried a bunch of stuff on their end and nothing has fixed the issue, so I’m curious to know if anyone else has experienced this, or anything like this, or has any suggestions.

    Thanks!

  • Hi @emlaser

    The image field save’s it’s data as only the image attachment ID. With this ID, it is able to load the image data via the function: wp_get_attachment_image_src.

    Perhaps you can do some research into this function and the https issue?

    Thanks
    E

  • With WP Engine and a similar issue.

    We have the following code

    <?php $image = wp_get_attachment_image_src(get_field('home_hero_image'), 'home-slide'); ?>
    <div class="home-top" style="background-image:url('<?php echo $image[0]; ?>');">

    This image source always outputs HTTP. So when we access page with HTTPS it warns us this is unsecure content. I’ll see if I can add another way, but I thought using $image[0] was best practice.

    Elliot

  • Update with code on Stack Overflow: http://stackoverflow.com/questions/24127714/wordpress-url-and-wp-get-attachment-image-src-http-vs-https/24551425#24551425

    I’m not convinced this is the best approach and suspect I am missing some core functionality somewhere.

  • This is a defect/bug in WP which will be fixed with the release of WP 4.0.

    In the meantime, instead of using replacement functions you can use the filter I posted here: http://stackoverflow.com/a/24686483/1231001

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘images urls converting to https’ is closed to new replies.