Skip to content

WordPress link preview shows the wrong image: fix og:image

Fix a WordPress link preview that shows the wrong image, an old title or no image at all on Facebook, LinkedIn, Slack, X or iMessage. You will see the page the way each platform's bot sees it, find the step that breaks, and refresh the stored preview where the platform allows it.

You shared a WordPress post on LinkedIn, Facebook, Slack, X or iMessage, and the card that appeared shows the site logo, an old title, last month’s photo, or no image at all. That card is built by a bot from the platform, which downloads your page, reads a few hidden tags in its HTML, and stores the result. That leaves five places where it can go wrong. It might be the platform’s stored copy, a firewall that turns the bot away, a page cache serving old HTML, the tags themselves, or the image file. Fetch your page with the bot’s user agent first, because what the bot receives tells you which place to fix.

What you’ll accomplish

  • See the exact HTML and tags that a platform’s bot receives from your site.
  • Tell a stale platform cache apart from a blocked bot, a stale page cache, and broken tags.
  • Make one SEO plugin the only source of Open Graph tags, with a correctly sized image.
  • Refresh the stored preview on Facebook and LinkedIn, and work around the platforms that offer no refresh.
  • Confirm the fix with the platforms’ own inspection tools.

Prerequisites

  • A terminal with curl. macOS and Linux include it, and so does Windows 10 and later.
  • Admin access to WordPress and to your SEO plugin: Yoast SEO, Rank Math, SEOPress or All in One SEO. Menu names below are from recent versions and can shift between releases.
  • If the site sits behind Cloudflare, access to its dashboard. Other CDNs (content delivery networks, which keep copies of your pages on servers near your visitors) have the same ideas under different names.
  • A post URL that shows the problem. The examples use https://example.com/spring-launch/.

How it works

Link previews run on Open Graph, a small set of <meta> tags in the page head, such as og:title, og:description and og:image. X also reads its own twitter:card and twitter:image tags, and falls back to the Open Graph ones when they are missing. WordPress core does not write any of these tags. Your SEO plugin does, or your theme, or sometimes both.

When someone pastes a link, the platform sends a bot to fetch it. Each bot has its own user agent (the name a client gives in its request): facebookexternalhit for Facebook, LinkedInBot for LinkedIn, Slackbot-LinkExpanding for Slack and Twitterbot for X. iMessage is the odd one out, since the sender’s own device builds the preview and stores it in the message.

Request path of a link preview, six steps from top to bottom: the link is shared, the platform scraper checks its own cache, the request passes the CDN or firewall, the page cache serves stored HTML, the bot reads the Open Graph tags, then it downloads the og:image file. The CDN or firewall step is marked as the focal failure, a 403 or challenge page so no tags are read. The other steps carry warnings: a cached copy with an old title or image, HTML from before your edit, missing or duplicate og:image tags, and an image that is too small, uses http:// or is WebP.

The diagram follows one share from top to bottom. The bot checks its own cache first, so a link it saw last week can return last week’s card without reaching your server. Otherwise the request crosses your CDN and firewall, the step marked in red. A bot that gets a 403 (access refused) or a challenge page (a “checking your browser” screen) reads no tags, so the card comes out blank. Past the firewall, a page cache can hand over HTML saved before your edit. Last, the bot fetches the og:image URL as a separate request, which can fail on its own.

You see a different version of the page than the bot does. You are logged in, your browser runs JavaScript, and your IP address is trusted. The bot is logged out, reads only the raw HTML, and arrives from a data centre. So every command below asks for the page the way a logged-out bot would.

Step-by-step

  1. Fetch the page as the bot and list its tags. This shows what the platform reads, after your CDN and page cache have had their say.
curl -s -A "facebookexternalhit/1.1" https://example.com/spring-launch/ | grep -ioE '<meta[^>]+(og|twitter):[^>]+>'

Example output:

<meta property="og:locale" content="en_US" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Spring launch: three new plans" />
<meta property="og:url" content="https://example.com/spring-launch/" />
<meta property="og:image" content="https://example.com/wp-content/uploads/2026/10/spring-launch-1200x630.jpg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:type" content="image/jpeg" />
<meta name="twitter:card" content="summary_large_image" />

That output is healthy: one og:image, an absolute https:// URL, and dimensions. Compare the title and image with what you expect. If they match, the platform shows an old stored copy, so go to step 6. If the output is empty, go to step 2. If the title or image predates your edit, go to step 3. Two og:image lines, or an image you never chose, such as the logo, mean step 4.

  1. Check the response code the bot gets. Empty output from step 1 means either no tags exist or the bot got an error page.
curl -sI -A "LinkedInBot/1.0 (compatible; Mozilla/5.0; Apache-HttpClient +http://www.linkedin.com)" https://example.com/spring-launch/

Example output:

HTTP/2 403
date: Fri, 16 Oct 2026 09:41:27 GMT
content-type: text/html; charset=UTF-8
cf-mitigated: challenge
server: cloudflare
cf-ray: 8d2f61b7ac94e3a1-YUL

A 200 means the bot gets the page, so the tags are missing, and step 4 applies. A 403 or 503 means something turned the bot away. The cf-mitigated: challenge header says Cloudflare served a challenge. Without it, the block came from WordPress or the server, for example a security plugin or a maintenance-mode plugin. A 401 means the site asks for a password (HTTP basic auth), which is common on staging sites, and no bot can pass it.

One caution: Cloudflare recognises the real bots by their IP addresses as well as their names. Your request uses the bot’s name from your own IP, so Cloudflare may block it as a fake while letting the real bot through. Treat a 403 here as a strong hint, and confirm it in step 5 or step 6.

  1. Rule out an old page cache. Look at the cache headers on the same URL.
curl -sI https://example.com/spring-launch/ | grep -iE 'cf-cache-status|^age|x-cache|x-litespeed-cache'

Example output:

cf-cache-status: HIT
age: 51840

HIT with a large age (in seconds, so 51840 is about 14 hours) means Cloudflare served a copy saved before your edit. Clear the page cache in your caching plugin first, using its admin-bar purge button, then purge the URL at Cloudflare under Caching → Configuration → Purge Cache → Custom Purge. Purge in that order, because otherwise Cloudflare can refill from the old plugin copy. To purge from a terminal, use an API token with the cache purge permission:

curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache" \
  -H "Authorization: Bearer $CF_API_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"files":["https://example.com/spring-launch/"]}'

Example output:

{"success":true,"errors":[],"messages":[],"result":{"id":"5e1c09a4b7d34f2a8c6e0b91d3f7a215"}}

Run step 1 again. The new title and image should appear.

  1. Make one plugin the only source of tags, and give it a proper image. Count the image tags first.
curl -s -A "facebookexternalhit/1.1" https://example.com/spring-launch/ | grep -o 'property="og:image"' | wc -l

Example output:

       2

Two means two pieces of code each print a set, often the SEO plugin plus the theme, Jetpack or a social-sharing plugin. Each platform picks between them in its own way, so Facebook and LinkedIn can show different pictures. Keep the tags from your SEO plugin and switch off the others. That might be a theme option such as “Open Graph meta”, the sharing module in a social plugin, or a second SEO plugin left active after a switch. Jetpack normally steps back from Open Graph when a major SEO plugin is active. If the count is still 2, view the page source and look for an HTML comment near each block that names the plugin. You are done with this part when the count command prints 1.

When the count is 0, the plugin’s Open Graph output is usually switched off. These are the settings to check:

  • Yoast SEO: Settings → Site features → Open Graph data. The site-wide fallback is the Site image under Settings → Site basics, and each post can set its own image in the Social section of the Yoast panel.
  • Rank Math: it prints the tags by default, so a count of 0 usually points to custom code or a second plugin removing them. Each post has a Social tab in the Rank Math panel. The fallback is the OpenGraph Thumbnail under Rank Math → Titles & Meta → Global Meta.
  • SEOPress: SEO → Social Networks → Facebook (Open Graph), where the default image also lives.
  • All in One SEO: All in One SEO → Social Networks → Facebook tab, where you choose the default image source.

When the wrong image shows, the plugin usually fell back to its default because the post had no usable image. The order is roughly this: a per-post social image, then the featured image, then the site default. A logo as the site default is the classic cause of “it always shows our logo”. Set a per-post social image on posts you share often, and make the site default a real 1200 × 630 pixel image. Meta recommends 1200 × 630 for link previews and treats images smaller than 200 × 200 as unusable. That ratio (about 1.91 to 1) also suits LinkedIn and X’s large card. Use JPEG or PNG for this one file. Support for WebP varies between platforms and AVIF is rarer, so an optimisation plugin that rewrites og:image to .webp can cost you the picture.

  1. Let the bots through the firewall. In Cloudflare, open Security → Events (Security → Analytics → Events in newer dashboards) and filter on the user agent, for example facebookexternalhit or LinkedInBot. Each event names the rule that acted.
  • Under Attack mode, or a challenge rule that applies to everyone: every bot fails the JavaScript check. Narrow the rule so it skips your public pages, or switch Under Attack mode off once the attack has ended.
  • A custom WAF rule that blocks by country or by “known bots”. A WAF (web application firewall) filters requests before they reach WordPress. Exclude bots on Cloudflare’s verified list by adding the Known Bots field (cf.client.bot) to the rule as an exception, or put a Skip rule above it.
  • Bot Fight Mode: it spares the bots on Cloudflare’s verified list, which includes the major social crawlers, so it is rarely the cause on its own. The article on Bot Fight Mode exemptions explains what can and cannot be exempted.

On the WordPress side, check your security plugin’s blocked-traffic log for these user agents. Check robots.txt too, since LinkedIn’s bot honours it and a Disallow: / aimed at all bots blanks LinkedIn previews. The WordPress robots.txt guide shows how to read it. A “coming soon” or maintenance plugin returns 503 to logged-out visitors, and the bot is always logged out. The fix holds when Facebook’s Sharing Debugger in step 6 reports response code 200 and Security Events shows no new action against that user agent.

  1. Refresh the platform’s stored copy. Each platform keeps its own copy and refreshes it on its own schedule.
  • Facebook: paste the URL into the Sharing Debugger and click Scrape Again. It shows the response code it got and every tag it read, with warnings for missing ones. The preview box at the bottom should now show your new image and title.
  • LinkedIn: paste the URL into the Post Inspector at https://www.linkedin.com/post-inspector/. Inspecting a URL fetches it again and updates the stored preview.
  • Slack and X: neither offers a public refresh button. X retired the preview in its Card Validator. Both refresh on their own after a while. If you need the new card now, share the URL with a harmless query string such as ?v=2, which they treat as a new link.
  • iMessage: a preview already sent lives in that message and never changes. New messages fetch it again from the sender’s device.

Facebook follows the og:url tag to the canonical address (the main address the page declares for itself), so the query-string trick does not help there. Use Scrape Again instead.

Validate it works

  1. The bot gets a 200 and one set of tags. Run step 1 and step 2 again. Expect HTTP/2 200 and exactly one og:image line.

  2. The image itself loads for a bot, over HTTPS. Copy the og:image URL from step 1:

curl -sI -A "facebookexternalhit/1.1" https://example.com/wp-content/uploads/2026/10/spring-launch-1200x630.jpg | grep -iE '^HTTP|content-type|content-length'

Example output:

HTTP/2 200
content-type: image/jpeg
content-length: 187342

A content-type of image/jpeg or image/png is what you want. If it says image/webp although the URL ends in .jpg, your optimisation plugin or CDN is swapping formats, so exclude that file from conversion.

  1. The platform tool agrees. Facebook’s Sharing Debugger should show response code 200, your new title, and your image in the preview box. LinkedIn’s Post Inspector should show the same image and title.

Troubleshooting

  • The image stays old after Scrape Again. Platforms also store the image file by its URL. If you replaced the picture but kept the same file name, they keep the old picture. Upload the new image under a new file name, set it as the social image, purge, and scrape again.
  • og:image starts with http:// or with /wp-content/. Bots need a full https:// address. An http:// URL usually means the site moved to HTTPS and stored URLs were never updated. Check wp option get home and wp option get siteurl, then run wp search-replace 'http://example.com' 'https://example.com' --dry-run. Remove --dry-run once the counts look right, and take a database backup first. Yoast keeps its own table of URLs, which wp yoast index --reindex rebuilds. A relative path like /wp-content/… usually comes from a theme or custom code printing its own tag, not from an SEO plugin.
  • Only the homepage shows the wrong image. The homepage has its own social settings. In Yoast they are under Settings → Content types → Homepage.
  • The preview works on Facebook but not LinkedIn. LinkedIn can reject very large image files and pages that are slow to answer. Keep the social image under 5 MB, the limit LinkedIn documents, and check that the page answers quickly for a logged-out visitor.

When this is the wrong approach

These steps fix how other platforms see one public page. If the featured image is missing or blurry on your own site, the cause is the theme or the image sizes, and WordPress featured image issues covers that instead. If a page should not be public at all, leave it blocked and accept a plain link. If dozens of URLs come back stale after every edit, the real fix is cache purging that runs on publish, so editors stop clearing caches by hand. And when you need to know exactly which tags exist, the Open Graph protocol lists them.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.