How to Set an Open Graph Image for Each WordPress Post in India
Set a unique Open Graph image for each WordPress post with Yoast SEO or Rank Math, verify the published tags, and fix common preview problems.
To set a different Open Graph image for each WordPress post, edit that post and choose its image in your SEO plugin’s social settings. In Yoast SEO, use the post’s Social media appearance controls; in Rank Math, use the editor’s Social tab. Save or update the post, then check that its published HTML contains the intended og:image value.
The settings are the standard WordPress plugin workflow; the research does not identify a separate India-specific setting or requirement. Menu labels can vary with plugin versions and editor configuration.
1. Choose the image for the individual post
Yoast SEO
- In WordPress, open Posts and edit the post.
- Open Yoast SEO in the editor sidebar and select Social media appearance (in some interfaces this is presented as a Social tab or panel).
- Set the image for the social preview and save the post with Update.
- If Yoast does not publish Open Graph tags, check that Open Graph data is enabled in Yoast SEO settings.
Yoast’s documented image selection order is: an image explicitly set in the post’s Social tab, the featured image, a prominent image in the content, then template or site defaults. Setting the image on the post gives editors direct control over that post’s social image.
Rank Math
- Open the post in the WordPress Block Editor.
- Open Rank Math in the editor sidebar and select Social.
- Upload or select the custom Open Graph/social preview image.
- Update the post.
Rank Math recommends an image of 1200 × 630 pixels and lists JPEG, PNG, and GIF as supported formats. Treat this as Rank Math’s recommendation, not a guarantee that every sharing platform will display the image identically.
Another plugin, a theme, or no SEO plugin
Check whether the active SEO or social plugin has a per-post social image control and whether it outputs Open Graph tags. If there is no separate image field, check the plugin’s documented fallback behavior; it may use the featured image or an image in the content. Before adding another Open Graph plugin, inspect what the current theme and plugins already emit. Two sources publishing the same tags can conflict.
2. Prepare and save the image
- Use a clear, representative image that makes sense when shown as a link preview.
- Follow the image dimensions and file formats recommended by your active plugin or sharing platform. For Rank Math, its documented recommendation is 1200 × 630 pixels, with JPEG, PNG, or GIF.
- Use a publicly accessible image URL. A private media URL, access restriction, or blocked request may prevent a platform from retrieving it.
- Save the post after changing the social image. Then check the rendered page, since the editor field alone does not prove the expected tag was published.
A featured image can serve as a fallback, but it is not always the same as the image selected specifically for social sharing. If the post needs a deliberate preview image, set it in the per-post social controls.
3. Verify the published Open Graph metadata
- Open the public URL of the post, not only the WordPress editor preview.
- View the page source or inspect the document’s
<head>. - Find
og:imageand confirm that its content value points to the intended image. - Check that there is one clear Open Graph source and that a second plugin or theme is not outputting competing
og:imagetags. - If the metadata is correct but a sharing platform still shows an older preview, use that platform’s available preview refresh or cache-clearing process.
For a basic command-line check, fetch the public page and search its HTML for Open Graph image tags:
curl -L 'https://example.com/your-post/' | grep -i 'property="og:image"'
Replace the example URL with the post’s public URL. This checks the HTML response; it does not guarantee how a platform’s crawler or cached preview will render the page.
4. Troubleshoot incorrect or missing previews
| Symptom | Likely cause | What to do |
|---|---|---|
No og:image tag in the page source |
Open Graph output is disabled, the plugin is not active for that content, or the page is served from stale cached HTML. | Check the plugin’s Open Graph setting, confirm the post uses the expected plugin, update the post, and clear the relevant page cache. |
| The featured image appears instead of the chosen social image | The per-post social image was not saved, or the active plugin’s image-selection behavior differs from the expected workflow. | Reopen the post’s social panel, confirm the selected image, save, and inspect the resulting og:image tag. |
| A different image appears in the source | A theme or another SEO/social plugin may also emit Open Graph metadata. | Check the source for repeated Open Graph tags and configure one source to control the tags. Yoast warns that duplicate Open Graph tags can lead social sites to show incorrect titles, descriptions, or images. |
| The tag points to an image that cannot be retrieved | The media URL may be private, invalid, or inaccessible to the crawler. | Use a valid public image URL and verify that it loads without requiring a logged-in session. |
| The page source is correct but a platform shows an old image | The platform may be using a cached preview. | Refresh the preview with the platform’s available inspection or cache-refresh tool, then check again. |
| The editor does not show the documented control | The interface may differ by plugin version, editor, or configuration. | Check the current plugin documentation and confirm the plugin is enabled for posts. The research covers the Yoast and Rank Math workflows described here. |
Developer option: change Yoast’s image with PHP
For custom behavior, Yoast documents the wpseo_opengraph_image filter for changing an existing Open Graph image for a single post. This is a developer route; most editors should use the post’s Social controls.
add_filter( 'wpseo_opengraph_image', function ( $image ) {
if ( is_single( 123 ) ) {
return 'https://example.com/wp-content/uploads/custom-share-image.jpg';
}
return $image;
} );
Replace 123 with the post ID and the example image URL with a publicly accessible image. Add PHP through a site-specific plugin or another established code-management method, and verify the published og:image value afterward. Yoast also documents related filters for image dimensions and type; use its developer documentation for the exact filter details.
5. India-specific considerations
The documented Yoast and Rank Math controls are the same standard WordPress workflow for this task. The research found no India-only Open Graph setting or local requirement affecting which per-post control to use. Choose an image appropriate for the post and its audience, and verify the metadata on the public page.
Or skip the browser setup
If you also need a screenshot of the finished post, ScreenshotNeo can return a PNG, JPEG, WebP, or PDF from one GET request. It is a website screenshot API and MCP server; it does not set WordPress Open Graph metadata.
ScreenshotNeo API documentation
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/your-post/ -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com/your-post/"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://example.com/your-post/'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await Bun.write('shot.webp', res);
- Cookie banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off.
- Bot checks, blank pages, timeouts, failed loads, and cache hits are never billed. Response headers indicate the page verdict and billing status.
- An MCP server lets AI agents, including Claude and Cursor, take screenshots with tools for screenshots, page information, and PDFs.
- 1,000 screenshots per month are free with no card. Paid plans start at $5 for 3,000 screenshots; all features are available on every plan.
Sign up for 1,000 free screenshots a month, with no card.
FAQ
Does every post need its own featured image?
No. A featured image can be a fallback, while a per-post social image lets you choose a different image for the link preview when your plugin supports that control.
Will the preview update as soon as I change the image?
The page metadata changes after the post is saved and the updated page is served. A sharing platform may continue showing a cached preview until it refreshes its copy.
Can I use a different Open Graph image from the one shown in the post?
Yes, when the SEO plugin provides a separate social image field. Set it for that post and verify that the published og:image tag points to it.
Can two plugins output Open Graph tags?
They can, but duplicate tags can cause incorrect social previews. Check the page source and keep one clear source responsible for the tags.


