-
Hi Team,
I am facing issues for all the articles having video schema as well. Its showing date from video schema not Articles. I published article this year but its showing 2020 as year which was used in Video.
-
Hello,
I apologize for the issue you are facing with the dates displayed in Google search results for your articles with video schema. It seems that Google is showing the date from the video schema instead of the actual article date, causing confusion for your visitors.
To address this issue, you can follow these steps to ensure that Google displays the correct dates for your articles:
- Update Video Schema Data: Google has updated its structured data guidelines for Video Schema, which may cause warnings if the
uploadDate
property is missing a timezone or has an invalid datetime value. You can fix this by including a filter in your theme’sfunctions.php
orrank-math.php
file. Here is the filter code you can use:
/** * Filter code to add time & timezone in existing Video Schema */ add_filter( 'rank_math/snippet/rich_snippet_videoobject_entity', function( $entity ) { if ( empty( $entity['uploadDate'] ) ) { return $entity; } $parts = explode( 'T', $entity['uploadDate'] ); if ( ! empty( $parts[ 1 ] ) ) { return $entity; } $entity['uploadDate'] = wp_date( 'Y-m-dTH:i:sP', strtotime( $entity['uploadDate'] ) ); return $entity; } );
By updating the Video Schema data with the correct timezone information, you can resolve the warnings related to the
uploadDate
property.If you need further assistance or have any other questions, please feel free to ask.
Thank you for bringing this concern to our attention.
Best regards,
Rank Math Support TeamSources:
How to Remove Date Snippets from Search Results » Rank Math
Resolving Rank Math Schema Markup Related Issues
How to Change the Date & Time on Your Posts/Pages » Rank MathHello,
Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.
Please note that search engines can find or guess the date from several sources on your page. However, if you want, you can change the upload date of your video schema from the Rank Math SEO Meta box Schema tab.
Once done, please allow Google some time to recrawl your page and it will automatically change the date in SERPs.
Hope that helps and please don’t hesitate to let us know if you have any other questions.
Thank you.Hi Rakibuzzaman Siam,
Thank you for the quick reply. But I don’t think that will be good. As we have many articles in this site and facing same issues. I want to show real publish date of article or modified date not Video date. I don’t to update manually Video upload date which is time taking also looks wrong.
I need to show article published date not date from video. How it will be solved with the help of code or hook?
Thanks!
Hello,
Yes, this can be achieved using a filter from our KB here.
Here’s the code I made for you:
add_filter( 'rank_math/snippet/rich_snippet_videoobject_entity', function( $entity ) { if ( empty( $entity['uploadDate'] ) ) { return $entity; } $entity['uploadDate'] = wp_date( 'Y-m-d\TH:i:sP', strtotime( get_the_date() ) ); return $entity; } );
You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.
Hi Jeremy,
I think your code only work if Video upload date not entered from admin. And it will always assign current date to the Video object where this upload date was empty.
In my case I have correct publish date assigned to articles but its picking date from Video schema not article itself. How to fix that?
Is there any hook which can be used to assign Article publish date to Video uploadDate?
Let me know if its still not clear.
Hello,
The
get_the_date()
function will retrieve the published date of the post, not the current date. You may check the details from WP: https://developer.wordpress.org/reference/functions/get_the_date/Can you please confirm if you are still referring to the changes you wish to do on the SERP: https://imgur.com/LFI1A6h
As we have mentioned before, Google uses various methods to determine dates for articles in search engine results pages and usually, it will be taken from the date that is visibly shown on the content.
There’s no hook or any code that will instruct Google what date should be shown on the SERP, meaning, we have no direct control over this.
Since the screenshot shows that it is taking the date from the upload date of your video, changing the uploadDate property in your schema should do it.
You can also adjust the
ya:ovs:upload_date
tag by using the filter code below:add_filter( 'rank_math/opengraph/facebook/ya_ovs_upload_date', function(){ return wp_date( 'Y-m-d\TH:i:sP', strtotime( get_the_date() ) ); });
Looking forward to helping 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.
- Update Video Schema Data: Google has updated its structured data guidelines for Video Schema, which may cause warnings if the
The ticket ‘Date showing in google result is wrong for Article’ is closed to new replies.