HTTPS issue for images on dev server | Images are not visible on dev server

While developing a website on a WordPress development server, sometimes images don't appear properly. If that is a https issue you just need to follow these step to resolve the issue.

1- From your WordPress dashboard go to 

Appearance >> Theme File Editor >> functions.php

2- Now add this code end of the functions.php

 

add_action('wp_footer','add_script_inside_footer');

function add_script_inside_footer(){ ?>

<script>

 

jQuery(document).ready(function($) {

  $('img').attr('src', function(i, s) {

return s.replace("https", "http");

  });

});

jQuery(document).ready(function($) {

$('img').each(function() { 

var currentSrcset = $(this).attr('srcset'); 

// Update srcset attribute

if (currentSrcset) {

$(this).attr('srcset', currentSrcset.replace(/https:/g, ''));

}

});

});

</script>  

<?php }

3- Check if there is any cache plugin on the dev server if yes deactivate it.

Now you can check the front end. The issue should be resolved.

Did you find this article useful?