Chapter 1

Getting Started

Add Open Graph meta tags to your WordPress site

Create a connection

  1. Sign in to OpenGraph+
  2. Go to your website’s Meta Tags page
  3. Create a new connection and copy your connection URL

Your connection URL looks like https://$OGPLUS_KEY.ogplus.net.

Find your theme header

Open your theme’s header.php file. You can find it at:

  • Appearance → Theme File Editor → select header.php
  • Or edit the file directly at wp-content/themes/your-theme/header.php

Add Open Graph meta tags

Add the following inside the <head> tag in header.php:

<head>
  <!-- ... other meta tags ... -->
  <meta property="og:title" content="<?= wp_title('', false) ?: get_bloginfo('name') ?>">
  <meta property="og:description" content="<?= is_singular() ? wp_trim_words(get_the_excerpt(), 30) : get_bloginfo('description') ?>">
  <meta property="og:url" content="<?= esc_url(home_url($_SERVER['REQUEST_URI'])) ?>">
  <meta property="og:site_name" content="<?= get_bloginfo('name') ?>">
  <meta property="og:type" content="<?= is_singular() ? 'article' : 'website' ?>">
  <meta property="og:image" content="https://$OGPLUS_KEY.ogplus.net<?= $_SERVER['REQUEST_URI'] ?>">
  <meta name="twitter:card" content="summary_large_image">
</head>

Replace https://$OGPLUS_KEY.ogplus.net with your actual connection URL.

Tag reference

Tag Value Source
og:title Current page/post title, falls back to site name wp_title() / get_bloginfo('name')
og:description Post excerpt (trimmed to 30 words) or site tagline get_the_excerpt() / get_bloginfo('description')
og:url Full canonical URL of the current page home_url() + $_SERVER['REQUEST_URI']
og:site_name Your WordPress site name get_bloginfo('name')
og:type article for posts/pages, website for archives/home is_singular()
og:image Dynamic social card image from OpenGraph+ Connection URL + page path
twitter:card Always summary_large_image for large preview cards Static value

What each function does

  • wp_title('', false) - returns the current page or post title without echoing it
  • get_the_excerpt() - returns the post excerpt, or auto-generates one from the content
  • wp_trim_words() - trims text to a word count (30 words keeps descriptions concise)
  • is_singular() - returns true on single posts and pages, used to set og:type to article
  • home_url() + $_SERVER['REQUEST_URI'] - builds the full canonical URL
  • get_bloginfo('name') - your site name from Settings → General
  • get_bloginfo('description') - your site tagline from Settings → General

Child theme recommended

If you’re using a third-party theme, create a child theme first so your changes survive theme updates.

Remove conflicting plugins

SEO plugins like Yoast, All in One SEO, and RankMath set their own Open Graph tags. If you have one installed, you may get duplicate meta tags. Either:

  • Disable the social/Open Graph feature in your SEO plugin
  • Add the OpenGraph+ meta tags through the plugin’s custom meta tag feature instead

Verify

Open the preview tool in your OpenGraph+ dashboard and paste a URL from your site. View your page source and confirm all Open Graph meta tags are present with correct values.