Platform Guide
Add automatic OG images to your WordPress site with a simple 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
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?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.
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"
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 beautiful OG images to your WordPress site.
Already have an account?
694c98497a352253877457ad1baef2d3f7a9c3f2