Set Custom Post feature image as og:image

It appears that your site doesn’t use the core WordPress Featured Image feature but instead uses a custom image field (probably from Advanced Custom Fields). Yoast’s plugin, Jetpack, and presumably many others look for the Featured Image image when setting the opengraph meta tag. So you have two options:

  1. Use the core Featured Image feature with one of the plugins that adds the featured image to an opengraph meta tag
  2. Change your meta property to use the ACF field:

<meta property="og:image" content="<?php $featuredImage = get_field('featured_image'); echo esc_url( $featuredImage['url'] ); ?>" />


Aside: if your featured image (however it’s implemented) has any meaning and is not “purely decorative,” make sure your site supports a way to give it appropriate alt text for accessibility.

Leave a Comment

error code: 523