Custom Image for Shared Links on Facebook

Using a little bit of code on your website, you can dictate what thumbnail image is displayed when someone shares a link to your site within Facebook.

For a static image, say you want your logo to always be shown when a link to your site is shared on Facebook, insert the following code:

Those who run a WordPress site can take it a step farther and add some php that will dynamically set the immage that Facebook uses when your web page gets shared. This code will look for a ‘Featured Image’ for your WordPress post. If one does not exist, you can set a fallback thumbnail. Add the following code to the header.php template file of your active WordPress theme.

This entry was posted in Code. Bookmark the permalink.