SEO Forge outputs Open Graph and Twitter Card meta tags on singular pages via SEOFORGE_Meta_Generator.
Output (Priority 1 on wp_head)
html
<meta property="og:type" content="article">
<meta property="og:title" content="Post Title | Site Name">
<meta property="og:description" content="Meta description text...">
<meta property="og:url" content="https://example.com/my-post/">
<meta property="og:site_name" content="Site Name">
<meta property="og:image" content="https://example.com/featured-image.jpg">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Post Title | Site Name">
<meta name="twitter:description" content="Meta description text...">
<meta name="twitter:image" content="https://example.com/featured-image.jpg">OG Image Cascade
- Per-post social image attachment (
_seoforge_og_image_id) - Stored social image URL (
_seoforge_og_image) when the attachment ID is stale - Post featured image (
get_the_post_thumbnail_url( $post_id, 'large' )) - WooCommerce placeholder image for product pages without product imagery
- Default OG image (
seoforge_default_og_imageoption)
Setting the Default OG Image
php
update_option( 'seoforge_default_og_image', 'https://example.com/default-social-1200x630.jpg' );Adding Additional OG Tags
php
add_action( 'wp_head', function () {
if ( ! is_singular() ) {
return;
}
$thumb_id = get_post_thumbnail_id();
if ( $thumb_id ) {
$meta = wp_get_attachment_metadata( $thumb_id );
if ( $meta ) {
echo '<meta property="og:image:width" content="' . esc_attr( $meta['width'] ) . '">' . "n";
echo '<meta property="og:image:height" content="' . esc_attr( $meta['height'] ) . '">' . "n";
}
}
// Add Twitter site handle
echo '<meta name="twitter:site" content="@mywebsite">' . "n";
}, 2 );—