The complaint is usually one of three flavors: “The featured image doesn’t show on the homepage.” “The Facebook preview uses the wrong image.” “The thumbnail in the related-posts widget is blurry.” All three are featured image bugs but they live in different layers — theme template, metadata, or thumbnail size. Treating them as one problem leads to chasing the wrong fix for hours.
What’s happening
A WordPress featured image is an attachment ID stored in _thumbnail_id postmeta on the post. The theme calls the_post_thumbnail( $size ) or get_the_post_thumbnail_url() to render it. Social previews use Open Graph and Twitter Card tags — WordPress core does not generate these; an SEO plugin (Yoast, Rank Math, AIOSEO) does, and each picks the image differently. Related-posts widgets pick whichever size they want, which may not exist on every attachment.
The three common failure modes: (1) _thumbnail_id is set but the attachment was deleted, so wp_get_attachment_image() returns empty; (2) the theme requests a size like 'featured-large' that no longer exists in wp_get_registered_image_subsizes(); (3) the SEO plugin uses og:image from a default fallback because the featured image is too small (Facebook requires 200x200 minimum, 1200x630 recommended).
How to verify
wp post meta get 1234 _thumbnail_id
wp post meta get $(wp post meta get 1234 _thumbnail_id) _wp_attachment_metadata --format=json
wp eval 'print_r( wp_get_registered_image_subsizes() );'
curl -s https://example.com/article-slug/ | grep -oE '<meta property="og:image[^>]*>'
curl -s https://example.com/article-slug/ | grep -oE 'thumbnail|featured' | head
wp eval 'echo wp_get_attachment_url(1234) . PHP_EOL;'
Use Facebook’s Sharing Debugger or LinkedIn’s Post Inspector to see what the social network actually fetches. Cached previews can lag for hours — force a refresh from the debugger when testing fixes.
The fix
- Audit orphaned
_thumbnail_idreferences. A query that finds posts whose featured image attachment no longer exists:SELECT pm.post_id FROM wp_postmeta pm WHERE pm.meta_key = '_thumbnail_id' AND pm.meta_value NOT IN (SELECT ID FROM wp_posts WHERE post_type = 'attachment');. Either restore the attachments or clear the orphan meta. - Verify the size exists for every attachment. If the theme requests
'featured-large'and the attachment’s metadata has no entry for that size, the call falls back to the original — which may be 4 MB. Runwp media regenerate --only-missingto fill the gaps. - Fix Open Graph image selection. In the SEO plugin, set a per-post OG image override on critical pages. For the site-wide default, use a 1200x630 PNG. Confirm in the debugger that the chosen image matches the featured image.
- Add a default featured image hook. Themes can filter
post_thumbnail_htmlto provide a fallback when no featured image is set, so the layout doesn’t break. Add it in the theme’sfunctions.phprather than relying on every post having one. - Test featured image sizes in the editor. The block editor’s featured image panel shows the file dimensions. If the editorial team is uploading 400x300 images for a layout that needs 1200x630, the template will always look soft — fix it in the upload workflow, not in CSS. Sites under enterprise WordPress hosting management get featured-image governance documented and enforced in the editor.
Stack Harbor’s enterprise WordPress hosting operating model includes featured image governance as part of the editorial workflow setup. When social previews keep breaking on releases, start the conversation.