Add Facebook Open Graph Meta Tags in WordPress

wordpress-add-open-graph

Adding Facebook Open Graph META data to your WordPress website allows you to specify which title, description and image is displayed when a URL from your website is shared on Facebook. This is particularly useful at preventing irrelevant images being added to the Facebook post, making it more attractive and in turn increasing your click-through rate from Facebook.

In this tutorial we will supply you with the required code to dynamically generate these Open Graph META tags for your WordPress posts and pages. However if you wish to skip this and let a plugin do the (not so) hard work for you, here are a couple of gems we recommend:

Open Graph META Tags

  • Site name: <meta property=”og:site_name” content=”” />
  • Post title: <meta property=”og:title” content=”” />
  • Post URL: <meta property=”og:url” content=”” />
  • Post type: <meta property=”og:type” content=”” />
  • Post image: <meta property=”og:image” content=”” />
  • Post description: <meta property=”og:description” content=”” />

Adding Open Graph META Tags into WordPress

The following code needs popping into your theme’s functions.php file. It will generate all of the above META tags and populate them with dynamic content pulled from the post:

Testing 1, 2, 3

Once you have added the above code to your website you can preview how a page will look when shared on Facebook using this handy little tool.

open-graph-checker

Leave a Reply

free vs porn

Don't be a stranger

You can keep up to date with us on Twitter, Facebook or any of your other favourite social networking sites. Alternatively please feel free to share our website with your friends.

Join our mailing list

Receive latest offers by email:

Close Form