Platform Guide
Add automatic OG images to your WordPress site with the official plugin or a code snippet.
Pick the option that works best for your setup:
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
Step 4: Open Settings → MyOG Social, paste your account hint, then enable OG image output.
Or install directly from wordpress.org/plugins/myog-social.
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?a=YOUR_ACCOUNT_HINT&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.
Account hint: Replace YOUR_ACCOUNT_HINT with the 4-character hint from your MyOG.social dashboard setup snippet.
Tip: MyOG detects content and branding automatically. You can choose an optional layout (Brand Card, Screenshot Right, Screenshot Bottom, Screenshot Only) in the MyOG.social dashboard.
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.3
*/
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?a=YOUR_ACCOUNT_HINT&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"
Step 4: Replace YOUR_ACCOUNT_HINT with the 4-character hint from your MyOG.social dashboard setup snippet.
Using Yoast, RankMath, or AIOSEO?
These plugins may set their own OG images. To use MyOG.social, you can:
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.
Sign up for free and add page-specific social cards to your WordPress site.
Already have an account?
a94331b1c71d6c264ca5a9e916f28a9580373503