[wp-trac] [WordPress Trac] #35648: the_post_thumbnail sets srcset with http protocol

WordPress Trac noreply at wordpress.org
Thu Jan 28 16:28:50 UTC 2016


#35648: the_post_thumbnail sets srcset with http protocol
-------------------------------------------------+-------------------------
 Reporter:  javiertoledos                        |      Owner:
     Type:  defect (bug)                         |     Status:  new
 Priority:  normal                               |  Milestone:  Awaiting
Component:  Post Thumbnails                      |  Review
 Severity:  normal                               |    Version:  4.4.1
  Focuses:  ui, javascript, administration,      |   Keywords:
  template                                       |
-------------------------------------------------+-------------------------
 We have a wordpress site that uses https always, when we use
 the_post_thumbnail, it returns HTTPS for the SRC attribute but it returns
 HTTP values for the SRCSET attribute. This is not a duplicate of #28261 or
 #15928 because this only happens on the srcset attribute.

 We had to do this filter in order to do a quick patch:


 {{{#!php
 <?php
 function fix_srcset_https_thumb_images ($html) {

     if ( is_ssl()) {
         $html = str_replace('http://','https://',$html);
     }
     return $html;
 }

 add_filter('post_thumbnail_html','fix_srcset_https_thumb_images') ;
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35648>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list