0

I'm using HTTPS everywhere in my website but I have problems with sharing buttons for Pinterest and Tumblr. For example, when I try to share image on Pinterest I get this error: "Sorry we could not fetch the image."

To make it work, I think I need to change image source URL protocols to HTTP only for my sharing buttons.

This is how I get thumbnail source:

$share_image_src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );

I need to change this: https:// www.example.com/wp-content/uploads/example-image.jpg

to this: http:// www.example.com/wp-content/uploads/example-image.jpg

1

Simply use set_url_scheme() function.

$share_image_src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
$share_image_src = set_url_scheme( $share_image_src, 'http' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.