Hey it’s been 2 weeks can you please get back to us ?
Hello,
Sorry for the delay in reply.
The temporary admin login you shared is currently not working. Please re-activate it so we can check the issue further.
Looking forward to helping you.
Hello,
It looks like there are as many video schemas as RankMath outputs, but most of them are empty ( not serialized correctly ).
For example for these two posts:
-
https://env-evabootcom-experiments.kinsta.cloud/blog/bypass-linkedin-weekly-invitation-limit
https://env-evabootcom-experiments.kinsta.cloud/blog/how-to-get-emails-from-linkedin-sales-navigator
When you run the query:
SELECT * FROM wp_postmeta
WHERE post_id IN (7023, 8150)
AND meta_key = 'rank_math_schema_VideoObject'
LIMIT 400
You get 301 entries, just for the two posts, one with 292 and the other with 9 ( they all appear to have content, but not correctly serialized ).
If you try to output the schemas for the two posts eg
add_filter( 'the_content', function ( $content ) {
global $post;
$schemas = get_post_meta( $post->ID, 'rank_math_schema_VideoObject' );
return $content;
});
Some keys of the $schemas
have false as value.
Solutions:
* Option 1 : Try and regenerate Video Schema, this will delete old entries and regenerate new ones, eliminating the issue you have currently.
* Option 2 : Delete empty ( incorrectly serialized video schemas ) by running delete_post_meta( $post->ID, 'rank_math_schema_VideoObject', false );
against all posts with video schemas ( you may need to backup your sites before this ).
* Option 3 : We have temporarily added if ( empty( $schema ) ) continue;
after L212 of file seo-by-rank-math-pro/includes/modules/video-sitemap/class-video-provider.php
We apologize for any inconveniences that might have been caused as a result of this issue.
Thank you.
Hello,
Thanks for the suggestions.
Regarding Option 1:
I could not find any tool to regenerate the Video Schema. According to your documentation(https://rankmath.com/kb/add-video-schema-to-existing-posts/), such a tool should exist, but there is nothing available on the website or in the plugin settings. Could you please clarify where exactly it can be accessed?
Regarding Option 3:
Simply adding if ( empty( $schema ) ) continue; might hide the problem temporarily, but it doesn’t actually fix the root cause or update the schema data correctly. I could have added such a workaround myself without waiting two months for a solution.
We need a real fix that regenerates or corrects the corrupted schemas, not just a way to skip over them.
Please advise on how to properly proceed.
Thank you.
Hello,
For the missing regenarate video schema for old posts feature ( https://rankmath.com/kb/add-video-schema-to-existing-posts/#generate-video-schema-for-old-posts-and-pages ), we re installed RankMath Free plugin and it was fixed.
Still the regenerate videos schemas was not working, but worked after deleting all entries of rank_math_schema_VideoObject
in the postmeta
table.
The video sitemap now shows 2400 entries from 6000+ when we had some empty.
We couldn’t reproduce this issue and we suspect it was a corrupt import, could you please share the source where you imported the schemas, if any; so we can troubleshoot with that.
Thank you.
Hi, I once used code like this to generate a schema
function find_and_add_video_schema($post_id) {
$content = get_post_field('post_content', $post_id);
// Поиск iframe с YouTube
if(preg_match('/<iframe.*src="https?:\/\/(?:www\.)?youtube.com\/embed\/([^"]+)".*><\/iframe>/', $content, $matches)) {
$video_id = $matches[1];
$video_schema = [
'@type' => 'VideoObject',
'name' => get_the_title($post_id),
'description' => get_the_excerpt($post_id),
'uploadDate' => get_the_date('c', $post_id),
'thumbnailUrl' => "https://img.youtube.com/vi/{$video_id}/maxresdefault.jpg",
'embedUrl' => "https://www.youtube.com/embed/{$video_id}"
];
update_post_meta($post_id, 'rank_math_schema_VideoObject', $video_schema);
}
}
add_action('save_post', 'find_and_add_video_schema');
did you see this message?
I sent it a week ago.
Hi, I once used code like this to generate a schema
function find_and_add_video_schema($post_id) {
$content = get_post_field(‘post_content’, $post_id);
// Поиск iframe с YouTube
if(preg_match(‘/<iframe.*src=”https?:\/\/(?:www\.)?youtube.com\/embed\/([^”]+)”.*><\/iframe>/’, $content, $matches)) {
$video_id = $matches[1];
$video_schema = [
‘@type’ => ‘VideoObject’,
‘name’ => get_the_title($post_id),
‘description’ => get_the_excerpt($post_id),
‘uploadDate’ => get_the_date(‘c’, $post_id),
‘thumbnailUrl’ => “https://img.youtube.com/vi/{$video_id}/maxresdefault.jpg”,
’embedUrl’ => “https://www.youtube.com/embed/{$video_id}”
];
update_post_meta($post_id, ‘rank_math_schema_VideoObject’, $video_schema);
}
}
add_action(‘save_post’, ‘find_and_add_video_schema’);
Hello,
That could be the cause of the issue as the video schema is incomplete ( missing some properties ).
Below is what is expected of the schema ( properties ).
[
'@type' => 'VideoObject',
'metadata' => [
'title' => 'Video',
'type' => 'template',
'shortcode' => uniqid( 's-' ),
'isPrimary' => empty( DB::get_schemas( $this->post->ID ) ),
'reviewLocationShortcode' => '[rank_math_rich_snippet]',
'category' => '%categories%',
'tags' => '%tags%',
'isAutoGenerated' => true,
],
'name' => '%seo_title%',
'description' => '%seo_description%',
'thumbnailUrl' => '%post_thumbnail%',
'embedUrl' => '',
'contentUrl' => '',
'duration' => '',
'width' => '',
'height' => '',
'isFamilyFriendly' => ''
]
Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.