Facebook automatically detects which image to use when a URL is shared by looking at the og:image meta tag in the pages html. Most WordPress themes, and certainly any WordPress SEO plugin worth a damn, set this tag automatically using the featured image. Sometimes it’s desirable to set a custom image for Facebook sharing. Fortunately, this is an easy fix in WordPress.

How Custom Facebook Images Are Set

There’s no telling how your theme handles the integration of featured images and the og:image meta tag. Every theme does this differently—some don’t do it at all. You can determine whether or not your theme (or already installed plugins) are doing this already by taking a look at the source code for your website. At the top of the page, check the <head> section for the og:image meta tag. It should look something like this:

og:image meta tag in source code

The og:image tag instructs Facebook which image to use when displaying a shared post

Notice some of the other tags there as well; WordPress inserts article tag meta (an SEO feature native to WordPress) and any SEO plugin worth the code it’s written in will be adding Twitter and Facebook tags for your site as well. These tags specify an image, description, site name, authorship, and several other fields of data for your post or page.

Setting a Custom Facebook Share Image

By default, most themes and/or SEO plugins will use the featured image of your WordPress as the og:image meta field. That’s to say, your posts’ featured image is what will be displayed when that link is shared, by you or anyone else, on Facebook.com. This isn’t always ideal.

Let’s say you want Facebook to display a different image than the featured image on your website. At the very least, one might do this to ensure the image dimensions are optimized for display on Facebook. Other reasons might include custom logos and/or watermarks, call-to-action texts, or images catered specifically to your Facebook followers. Whatever the reason, the process of specifying a custom Facebook image for your WordPress post is ultimately the same: override the featured image for the og:image meta tag.

Step 1: Install the Yoast SEO Plugin

The Yoast SEO plugin isn’t the only way to accomplish this task but it’s the easiest. It’s the most popular WordPress SEO plugin, it’s updated regularly, and it comes packed with many other features that are valuable for SEO.

Step 2: Specify an Override Image on Any Post, Page, or Taxonomy

With the Yoast SEO plugin installed, each Post, Page, and Taxonomy (tags, categories, etc.) page will now have a custom SEO metabox shown below the main content field in the edit views. This is where the magic happens. Click the social tab on this box, expand the Facebook (or Twitter) section, and specify which data you wish to override. Uploading an image here will override your featured image in the og:image meta tags for your post/page/taxonomy. As of Version 11.8, only Facebook and Twitter are options. Previous versions allowed for the customization of Google+ (no longer active) and Pinterest fields. See below:

Yoast SEO custom facebook image

The Yoast SEO plugin creates a metabox with options to customize Facebook and Twitter sharing options.

Final Tips

WordPress + Yoast SEO is one of the most popular and effective ways to set up your website for success. One of the many benefits of these two technologies is the ease by which one can specify custom Facebook (and Twitter!) sharing images. There are other plugins, such as Mash Share that extend this type of capability to other networks such as Pinterest. Always be careful while piling on extra plugins.

Many can cause conflicts and most cause a hit on site performance. If your website is running slow, or you’re looking to speed it up, check out our review of the best managed WordPress hosting providers. If you’re into tweaking your own server and handling your own backups, check out our review of the best regular web hosting providers.