WordPress how-to

How to change og image WordPress

To change og image wordpress, pick one writer for the tag. You add og image to wordpress in one of three places: the featured image, an SEO-plugin social image, or a generated card. WordPress does not turn the featured image into og:image by itself. The theme handbook describes featured images as pictures a theme prints with the_post_thumbnail() after add_theme_support('post-thumbnails'). A theme hook or a plugin has to add the meta tag. This page is the how-to. The plugin comparison stays on the WordPress lander.

The query how to add og image in wordpress is the same job: wordpress add og images in the post editor, in the SEO plugin, or by generating a card. An open graph image wordpress site and a wordpress open graph image both fail the same way when two plugins print og:image, or when the tag points at a file the crawler cannot fetch.

Install the WordPress plugin when posts, pages, or products should get a generated card, get an API key to sign CDN URLs from another server, install MCP when an agent should call generate_og_image, read the API docs for JWT claims and the PHP SDK, compare the hosted API with @vercel/og and DIY Satori, or check the permalink before you trust a share.

When each path fits

Featured image SEO-plugin social image Generated card
When it fits One designed file is the whole preview, and you will maintain the theme hook. Yoast or Rank Math already owns the tags, and the artwork is an upload. Posts should look branded without a new file, or an agent should create the image.
Where you change it The post editor featured image. Then a wp_head hook if nothing else prints og:image. Yoast Social tab, or Rank Math's OpenGraph image on the post. The OG Pilot plugin, or a URL from the API or MCP.
Who writes og:image Your theme or a small custom plugin. Yoast or Rank Math. The OG Pilot plugin, unless Meta Ownership is External SEO plugin.
When the title changes The tag stays on the same file until you upload another one. The tag stays on the file you uploaded for that post. The plugin or API can rebuild the card from the new title and excerpt.
Skip it when An SEO plugin is also printing og:image. You want a template, not another upload. One unchanging campaign file is enough.

Change the featured image

  1. Open the post or page and set the featured image. WordPress stores that attachment as the post thumbnail.
  2. Leave the theme hook out if Yoast, Rank Math, or another plugin already prints og:image. Two tags are worse than one.
  3. If nothing else writes the tag, print the attachment URL from wp_head. Use the full size when you want the file the social apps will fetch.
  4. Publish, then open the permalink in the Open Graph debugger.
add_action( 'wp_head', function () {
    if ( ! is_singular() || ! has_post_thumbnail() ) {
        return;
    }

    $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
    if ( ! $image ) {
        return;
    }

    $url = esc_url( $image[0] );
    echo '<meta property="og:image" content="' . $url . '" />' . "\n";
    echo '<meta name="twitter:card" content="summary_large_image" />' . "\n";
    echo '<meta name="twitter:image" content="' . $url . '" />' . "\n";
} );

That sample is a hook you maintain. It is not WordPress core. The URL has to be absolute https. A relative path can look fine in the editor and fail in a unfurl.

Set the SEO-plugin social image

Yoast's Open Graph functional spec sets og:image from a user-defined Facebook image in the Social tab, then the featured image on posts, then a prominent image from the content, then the social default from Search Appearance, then the site fallback. The current help article labels the editor Social media appearance. The spec still calls the stored field a Facebook image. Rank Math's Open Graph guide lists the image as the Social-tab OpenGraph image, then the featured image, then the first image in the post, then the default OpenGraph thumbnail. Its Titles and Meta guide recommends 1200 by 630 pixels for that thumbnail.

Set the social image on the post when this share should differ from the featured image. Set the sitewide default when most URLs should share one file. Save, then view source or the debugger and confirm a single og:image. These plugins attach the tag to a file you already have. They do not draw a new card when the headline changes.

Use a generated card

Use this path when the open graph image wordpress should follow the title, excerpt, or product fields. On the site, install OG Pilot Dynamic Open Graph Images from the WordPress lander, activate it, and choose Connect with OG Pilot. The listing says the plugin uses OAuth with PKCE, so you do not paste a long-lived API secret into the theme. Pick a default template. Public templates named on the listing are page, blog_post, podcast, portfolio, book, event, product, company, and github. If Yoast, Rank Math, or AIOSEO should keep the tags, set Meta Ownership to External SEO plugin.

Outside WordPress, sign the request on your server and place the CDN URL in og:image. The comparison with @vercel/og and a DIY Satori pipeline is on the OG image API page. That is the page to use when the fix is a generated card rather than another upload.

POST https://ogpilot.com/api/v1/images
Content-Type: application/json
Accept: application/json

{"token":"YOUR_JWT_TOKEN"}

Required JWT claims: iss (verified domain), sub (API key prefix).
If iat is present, the image cache is valid for 24 hours from that
timestamp. Omit iat and the cache does not expire on its own.
Prefer an official SDK. Docs: https://ogpilot.com/docs

The connected plugin does not send that JWT. It calls the WordPress namespace with the OAuth access token. The request shape below is what this app accepts. Keep the bearer token in the plugin. Do not copy it into a theme file.

POST https://ogpilot.com/api/v1/wordpress/images
Authorization: Bearer WORDPRESS_ACCESS_TOKEN
Accept: application/json

template=blog_post
path=/posts/hello-world
title=Hello World
description=From WordPress

A missing or invalid token returns 401 unauthorized.
An inactive subscription returns 403 subscription_required.

Agents use the remote MCP server. generate_og_image takes a public url and an optional style and returns image_url. Debug, compress, and palette work on a guest connector session. generate_og_image needs an account with an active plan. A trial is not enough. Setup is on /docs/mcp.

Remote MCP URL: https://ogpilot.com/mcp
Transport: Streamable HTTP
Auth: OAuth 2.1 with PKCE

generate_og_image
{ "url": "https://example.com/your-post" }

The plugin FAQ says most images are ready within 5 to 10 minutes depending on queue load and the site traffic that triggers WP-Cron. The plan catalog lists Starter at $5/month ($50/year, 10,000-image quota), Builder at $49/month ($99/year, 100,000-image quota), and Growth at $99/month ($199/year, unlimited image quota). Those defaults are on pricing. A Stripe image_quota feature can replace the quota. The catalog has no per-image price.

Where to add og images for social media on a WordPress site

The query where to add og images for social media on wordpress site is about the editor, not a second tag name. The HTML location is always the same: a meta property og:image in the document head, plus twitter:image when you want the large card. The editor location is not.

A wordpress plugin for og tags is whichever plugin you let own the head. Yoast, Rank Math, and AIOSEO are upload-based. OG Pilot is the generated-card plugin. Running two of them without turning one off produces duplicate og:image tags. After you change the file, change the URL or force a rescrape. Facebook, LinkedIn, X, and Slack cache the bytes, not your WordPress editor.

Open Graph tags, next to this how-to

What og:title, og:description, og:image, and og:url mean in a theme or plugin is a separate explainer and that page is not published yet. Until it is, use the WordPress lander for which tags the plugin writes and when to leave them to Yoast or Rank Math. Do not guess a second URL for that explainer. This page only covers changing the image.

When the preview is still wrong, run the permalink through the Open Graph debugger. Create an API key for a signed URL, install MCP for an agent, or go back to the plugin when the library is posts, pages, and WooCommerce.