Skip to content

Connected my WordPress site and it keeps grabbing the wrong image

Alex Morgan

Set up the site connection so new posts generate pins automatically. Roughly one in three picks the wrong image - usually an inline screenshot halfway down the post, sometimes my author headshot, occasionally a 1x1 tracking pixel.

I have a featured image set on every post. Yoast has a separate social image field which is set on maybe half of them. Images below the fold are lazy-loaded with data-src. What's the precedence supposed to be, and is lazy loading the thing breaking it?

2 replies

Lazy loading is almost certainly it, at least for the tracking pixel case. If the scraper walks the DOM looking for the largest src and everything real is in data-src, the only honest src on the page is your 1x1 and your headshot in the sidebar.

Set the Yoast social image on everything. That writes og:image, which anything sane prefers over DOM scraping, and it ends the guessing.

Also check you don't have two og:image tags. I had my theme emitting one and Yoast emitting another, and which one got picked depended on the scraper's mood. View source and search for og:image, you should see exactly one.

Join the conversation. Sign in to reply