Wrong image appearing in Twitter cards - using WordPress + SEO by Yoast plugin


#1

Hiya,

I’m using WordPress and SEO by Yoast. I’ve just set up Twitter cards and all went smoothly, except I’ve just noticed that the ‘wrong’ image shows up in some of the cards. I’d really like the “featured image” to be the one that appears in the card - rather than the one that currently shows (which is actually an ad that sits at the top of each blog post). Is there a way to ensure (or choose) that the image that shows up is the featured image?

Many thanks,
Brin


#2

Anything on this anybody please…


#3

Hello?


#4

Oh! I do like to be beside the seaside
I do like to be beside the sea!
I do like to stroll upon the Prom, Prom, Prom!
Where the brass bands play:
“Tiddely-om-pom-pom!”


#5

It appears posting here may do no good as nobody from Twitter replied but can confirm this problem. We noticed it two weeks ago - the images on our photo and gallery cards are sometimes right and sometimes wrong. You can look at a card, it will display correctly, refresh the page and then the card show the wrong image (one from a previous card), refresh the page again and then its correct, so on and so on.


#6

yep same observations here. our cards are random all the time / wrong. They are images from our site but not the in the meta data of the link that was posted. it’s like their proxy server or caching is all messed up. very frustrated.


#7

We can also confirm this as well. ^NE


#8

It is confirmed that Twitter erroneously chooses the last speced og:image tag and not the first, as the OG spec explicitly says it should.

A workaround can be to add a specific twitter image tag. This has been talked about in Yoast Wordpress SEO Git repo, but is not implemented in the plugin as of now.

You should be able to do something like this in your theme header manually:

if post has featured image {
print twitter image tag with that thumbnail
}

Note: It’s not trivial to access featured image from outside the loop, and the image needs to be < 1 MB file size so you probably want to get a downsized version.


#9

I found a simpler workaround. Insert the image you want to appear at the end of your page/post and then set its height and width to 0px. This should then force it to appear as the last OG tag but not appear on your page/post. Looking forward to being able to specify the image for Yoast with a custom field in the article!


#10

Jamie’s workaround needs an extra. Because the image has already been used, Twitter skips over it’s second use. To fix this, add ?1 after the img URL.

e.g. imagename.jpg?1

This forces Twitter to see a new instance.

et voila


#11

We are having the same issue and looking for advice. The images Twitter Cards are using are our author images, rather than the featured image in our WordPress post. We are also on WordPress SEO though I’m curious if this issue is only limited to that plugin or WordPress pages in general.