Question
Answer and Explanation
When you share a WordPress page or post on social media or other platforms, WordPress attempts to display a preview image. The image that WordPress shows in the preview is determined by a few factors, and it follows a specific hierarchy:
1. Featured Image (Post Thumbnail):
- The primary image WordPress uses for previews is the "Featured Image," also known as the "Post Thumbnail." This image is specifically set for each post or page in the WordPress editor. If a featured image is set, it will almost always be the image used in previews.
2. Open Graph (OG) Meta Tags:
- WordPress, often through plugins like Yoast SEO or Rank Math, generates Open Graph meta tags. These tags include og:image
, which specifies the image URL to use for previews. If a featured image is set, these plugins will typically use that image for the og:image
tag. If you have a custom image set in your SEO plugin, that will take precedence over the featured image.
3. First Image in Content:
- If no featured image is set and no og:image
tag is present, WordPress will attempt to use the first image it finds within the content of the post or page. This is a fallback mechanism to ensure there is at least some image to display.
4. Default Theme Image:
- In some cases, if no featured image, og:image
tag, or content image is found, WordPress might use a default image set by the theme. This is less common but can occur if the theme is configured to provide a fallback image.
5. No Image:
- If none of the above conditions are met, WordPress will not display an image in the preview. This can result in a less engaging preview on social media and other platforms.
How to Control the Preview Image:
- Set a Featured Image: The most reliable way to control the preview image is to set a featured image for each post or page. This ensures that the correct image is used.
- Use an SEO Plugin: Plugins like Yoast SEO or Rank Math allow you to set custom Open Graph images, giving you more control over how your content appears when shared.
- Check Theme Settings: Some themes have options to set a default preview image. Check your theme's settings if you are not using a featured image or SEO plugin.
By understanding this hierarchy, you can ensure that your WordPress content is displayed with the correct preview image when shared on social media and other platforms, improving engagement and visibility.