Platform Guide

WordPress Integration

Add automatic OG images to your WordPress site with a simple code snippet.

Prerequisites

  • A WordPress site (self-hosted or WordPress.com Business+)
  • A MyOG.social account —
  • Your domain added to MyOG.social dashboard

Choose your method

Pick the option that works best for your setup:

A

Option A: Install the Official Plugin

Recommended

The easiest way to get started. Install directly from WordPress.org, automatic updates included.

Step 1: In your WordPress admin, go to Plugins → Add New

Step 2: Search for MyOG Social

Step 3: Click Install Now, then Activate

Or install directly from wordpress.org/plugins/myog-social.

B

Option B: Add to functions.php

Step 1: In your WordPress admin, go to Appearance → Theme File Editor

Step 2: Select functions.php from the right sidebar

Step 3: Add this code at the end of the file:

// Add MyOG.social OG image meta tag
add_action('wp_head', function () {
    $page_url = is_singular() ? get_permalink() : home_url(esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'] ?? '/')));
    $og_image = 'https://api.myog.social/og?url=' . rawurlencode($page_url);

    echo '<meta property="og:image" content="' . esc_attr($og_image) . '">' . "\n";
}, 99);

Note: If you change themes, you'll need to add this code again to the new theme's functions.php.

Tip: You can choose from different templates (Brand, Screenshot Right, Screenshot Bottom, Screenshot Only) in the MyOG.social dashboard.

C

Option C: Create a Mini Plugin

This method survives theme changes and is easier to manage.

Step 1: Create a file called myog-social.php with this content:

<?php
/**
 * Plugin Name: MyOG Social
 * Description: Automatic OG image generation via MyOG.social
 * Version: 1.0.0
 */

add_action('wp_head', function () {
    $page_url = is_singular() ? get_permalink() : home_url(esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'] ?? '/')));
    $og_image = 'https://api.myog.social/og?url=' . rawurlencode($page_url);

    echo '<meta property="og:image" content="' . esc_attr($og_image) . '">' . "\n";
}, 99);

Step 2: Upload this file to /wp-content/plugins/ via FTP or your hosting file manager

Step 3: Go to Plugins in WordPress admin and activate "MyOG Social"

SEO Plugin Compatibility

Using Yoast, RankMath, or AIOSEO?

These plugins may set their own OG images. To use MyOG.social, you can:

  • Disable OG images in your SEO plugin's social settings
  • Or use MyOG only for posts without a featured image (our tag acts as fallback)

Test your setup

Use our OG Preview tool to test any page on your site, or share a link on Twitter/LinkedIn to see your new OG image in action.

Ready to get started?

Sign up for free and add beautiful OG images to your WordPress site.

Already have an account?

694c98497a352253877457ad1baef2d3f7a9c3f2