Title: thumbnails are not loaded via https if needed
Last modified: August 22, 2016

---

# thumbnails are not loaded via https if needed

 *  Resolved [B M](https://wordpress.org/support/users/mampf/)
 * (@mampf)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/)
 * Hello,
 * having optional ssl, I see the thumbnails loaded over [http://](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/?output_format=md),
   even on a ssl-secured connection (https-protocol).
 * I know there are some bugs in WordPress, but would it be possible to check for
   is_ssl() and reset the protocol? You could also use protocol-relative links like`
   <img src="//domain.tld/path/to/image.png" >`.
 * I think this should be done in `crp_get_the_post_thumbnail`.
 * [https://wordpress.org/plugins/contextual-related-posts/](https://wordpress.org/plugins/contextual-related-posts/)

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Thread Starter [B M](https://wordpress.org/support/users/mampf/)
 * (@mampf)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180319)
 * My workaround on line 836:
    `$postimage = preg_replace('~https?://~', '//', $
   postimage);`
 * Then don’t forget to empty the cache.
 * Also possible:
 *     ```
       if (is_ssl()) {
           $postimage = preg_replace('~http://~', 'https://', $postimage);
       }
       ```
   
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180488)
 * Thanks. let me look into this.
 * Wouldn’t this be a better option rather than the protocol independent link?
 *     ```
       if (is_ssl()) {
           $postimage = preg_replace('~http://~', 'https://', $postimage);
       }
       ```
   
 *  Thread Starter [B M](https://wordpress.org/support/users/mampf/)
 * (@mampf)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180492)
 * Don’t really know. I’d say, most servers are overloaded already, and let the 
   client do as much as possible.
 * On the other hand, having the protocol specified would be more consistent.
 * Your choice, both goes well.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180592)
 * Will run a few tests at my end. I’ve got limited access to an SSL site (not a
   production one unfortunately) but I can give it a go to see how it displays.
 *  [pfm](https://wordpress.org/support/users/pfm/)
 * (@pfm)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180625)
 * Hi,
 * do I have to fix the link to the posts the same way? All the generated links 
   do have http instead of https (the site was switched from http to https). All
   other plugins do show https links. Cache was emptied. Index rebuild.
 * Thanks for your help.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180656)
 * Hi,
 * v2.0.1 should fix the SSL issues. Could you please give this a shot?
 *  Thread Starter [B M](https://wordpress.org/support/users/mampf/)
 * (@mampf)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180657)
 * Are you sure your commit did make it? Didn’t try it yet, but I don’t see a suitable
   commit in the [Commit log](https://plugins.trac.wordpress.org/changeset?sfp_email=&sfph_mail=&reponame=&new=982350%40contextual-related-posts&old=980558%40contextual-related-posts&sfp_email=&sfph_mail=).
 * Also, I won’t dare to try using a version where “wp-admin” is hardcoded. This
   might be a new core feature in future releases, see [#13118](https://core.trac.wordpress.org/ticket/13118).
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180659)
 * v2.0.0 has the SSL code changes. You’ll find a more detailed commit log on Github.
 * v2.0.1 fixed an ajax issue.
 * on wp-admin. The plugin checks for is_admin anyways and as a fall back checks
   wp-admin.
 * I’ve noticed that the ajax clear cache button breaks at times when the wp-admin
   is omitted.
 *  Thread Starter [B M](https://wordpress.org/support/users/mampf/)
 * (@mampf)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180664)
 * Sorry for not replying sooner. I’ll set it to solved, works for me.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180665)
 * Thank you for confirming !

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘thumbnails are not loaded via https if needed’ is closed to new replies.

 * ![](https://ps.w.org/contextual-related-posts/assets/icon-256x256.png?rev=2985705)
 * [Contextual Related Posts](https://wordpress.org/plugins/contextual-related-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contextual-related-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contextual-related-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/contextual-related-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contextual-related-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contextual-related-posts/reviews/)

## Tags

 * [SSL](https://wordpress.org/support/topic-tag/ssl/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 10 replies
 * 3 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/thumbnails-are-not-loaded-via-https-if-needed/#post-5180665)
 * Status: resolved