Rank Forge outputs Open Graph and Twitter Card meta tags via RANKFORGE_Meta_Generator on single posts and pages, the home page, term and post type archives, author and date archives, and search and 404 pages. Attachment pages and feeds get none. Of the Twitter tags, Rank Forge writes twitter:card, twitter:title, twitter:description and twitter:image, not twitter:site or twitter:creator; the example under Adding Additional OG Tags adds twitter:site by hand.
Output (Priority 1 on wp_head)
<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 (
_rankforge_og_image_id) - Stored social image URL (
_rankforge_og_image) when the attachment ID is stale - Post featured image (
get_the_post_thumbnail_url( $post_id, 'full' )) - WooCommerce placeholder image for product pages without product imagery
- Default OG image (
rankforge_default_og_imageoption)
Setting the Default OG Image
update_option( 'rankforge_default_og_image', 'https://example.com/default-social-1200x630.jpg' );Adding Additional OG Tags
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 );—