Back to Blog

How to Set Up OG Images in WordPress (2026 Guide)

Jun 23, 2026·4 min read

WordPress powers over 40% of the web, but it doesn't generate OG images out of the box. Here's how to add them — with plugins and manually.

Option 1: Use an SEO Plugin (Easiest)

Yoast SEO

Go to Yoast SEO → Settings → Social → Facebook. Enable Open Graph metadata. Then on each post, scroll to the Yoast metabox → Social tab → upload your OG image.

Rank Math

Rank Math → Titles & Meta → Open Graph. Enable and configure.

All in One SEO (AIOSEO)

AIOSEO → Social Networks → Facebook. Toggle on and set a default OG image as fallback.

Option 2: Generate with Our Tool

For complete design control, create your OG images with our free generator, then set them as the Featured Image in WordPress.

Option 3: Theme Functions (Manual)

Add this to your theme's functions.php:

function add_og_tags() {
  if (is_single()) {
    $img = get_the_post_thumbnail_url(null, 'full');
    echo '<meta property="og:image" content="' . $img . '">';
    echo '<meta property="og:image:width" content="1200">';
    echo '<meta property="og:image:height" content="630">';
  }
}
add_action('wp_head', 'add_og_tags');

Troubleshooting

  • Duplicate tags: Disable OG output in all but one plugin.
  • Image not updating: Clear your WordPress cache, then use our OG checker to verify.
  • Facebook shows old image: Run the URL through Facebook Sharing Debugger.

Create your OG image now

Free, no signup, instant download. 5 templates to choose from.

Open Generator →

Related Articles