Automatic video detection, VideoObject JSON-LD schema, and a dedicated video sitemap. SEO Forge scans post content for embedded videos and generates the appropriate structured data and sitemap entries. PRO feature.
Auto-Detection
On save_post (priority 18), SEO Forge scans the post content for video embeds from the following platforms:
- YouTube —
youtube.com/watch?v=,youtube.com/embed/,youtu.be/ - Vimeo —
vimeo.com/,player.vimeo.com/video/ - HTML5
—
Detected videos are stored as a JSON array in _seoforge_videos post meta.
Video Schema Output
On wp_head (priority 6), SEO Forge outputs VideoObject JSON-LD for posts with videos. Manual video (_seoforge_video_url) takes priority over auto-detected.
json
{
"@context": "https://schema.org",
"@type": "VideoObject",
"name": "Post Title",
"description": "Video description or excerpt",
"thumbnailUrl": "https://img.youtube.com/vi/abc123/maxresdefault.jpg",
"uploadDate": "2024-01-15T08:00:00+00:00",
"contentUrl": "https://www.youtube.com/watch?v=abc123",
"embedUrl": "https://www.youtube.com/embed/abc123",
"duration": "PT5M30S"
}Video Sitemap
Accessible at /video-sitemap.xml. Cached via transient with a 1-hour TTL.
xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>https://example.com/my-video-post/</loc>
<video:video>
<video:title>My Video Post</video:title>
<video:content_loc>https://www.youtube.com/watch?v=abc123</video:content_loc>
<video:thumbnail_loc>https://img.youtube.com/vi/abc123/maxresdefault.jpg</video:thumbnail_loc>
</video:video>
</url>
</urlset>Setting Video Meta Programmatically
php
$post_id = 42;
// Manual video override (takes priority over auto-detected)
update_post_meta( $post_id, '_seoforge_video_url', 'https://www.youtube.com/watch?v=abc123' );
update_post_meta( $post_id, '_seoforge_video_thumbnail', 'https://example.com/thumbnails/thumb.jpg' );
update_post_meta( $post_id, '_seoforge_video_duration', 'PT10M15S' );
update_post_meta( $post_id, '_seoforge_video_description', 'A tutorial on WordPress SEO.' );
// Force re-detection of videos in post content
SEOFORGE_Video_Seo::instance()->auto_detect_videos( $post_id, get_post( $post_id ) );
// Read auto-detected videos
$videos = json_decode( get_post_meta( $post_id, '_seoforge_videos', true ), true );
if ( is_array( $videos ) ) {
foreach ( $videos as $video ) {
echo "Platform: {$video['platform']}, ID: {$video['id']}n";
}
}Disabling Video Schema
php
add_action( 'init', function () {
if ( ! class_exists( 'SEOFORGE_Video_Seo' ) ) {
return;
}
remove_action( 'wp_head', [ SEOFORGE_Video_Seo::instance(), 'output_video_schema' ], 6 );
}, 20 );—