index date problem

#743072
  • Resolved Anonymous
    Rank Math free

    hello The Google index date of the topics we opened seems to be old, 2024, the topic opened seems to be 2020

    We researched and realized that YouTube video is indexed with that date, how can I solve this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    I apologize for the issue you are facing with the Google index date showing incorrectly for your topics. If the topics are being indexed with an old date due to a YouTube video, you can resolve this by updating the Schema data for the video.

    To fix this issue, you need to include a filter in your theme’s functions.php or rank-math.php file. This filter will ensure that the UploadDate Schema property includes the correct timezone information. Here is the code snippet 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 adding this filter, you can ensure that the correct timezone information is included in the Schema data for the YouTube video. This should help Google display the accurate date for your topics in the search results.

    If you need further assistance or have any questions, please feel free to reach out to our dedicated support team here. We are available 24/7, 365 days a year to assist you.

    We appreciate your understanding and patience while we work to resolve this issue for you.

    Thank you!

    Sources:
    How to Remove Date Snippets from Search Results » Rank Math
    How to Change the Date & Time on Your Posts/Pages » Rank Math
    Resolving Rank Math Schema Markup Related Issues

    Anonymous
    Rank Math free

    Thank you very much, I added it to the place you mentioned, by the way, I am using Rank Math Pro, it is licensed.

    Anonymous
    Rank Math free

    Can I add it to rank-math-pro.php?

    Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    Could you please share the affected URL with us so that we can check the issue further? However, if you want to use the filter, you’ll have to include this in the rank-math.php file or you can use any of the methods mentioned here: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Also, you mentioned that you’re using the Rank Math PRO plugin on your website, but the account you used to open this ticket is the Rank Math free version.

    Can you please search and forward a receipt from FastSpring.com so we can locate your account and verify it?

    Looking forward to helping you.

    Thank you.

    Anonymous
    Rank Math free

    For example, the topic opened yesterday appears to be an index dated 2014, I added a filter and the problem persists.

    Anonymous
    Rank Math free

    I added it to rank-math.php at the bottom, it didn’t work, I added the filter to the top, let’s see if it works.

    Hello,

    You mentioned that you’re using Rank Math PRO but the account you have used to open this ticket is the Rank Math free version.

    Can you please search and forward a receipt from FastSpring.com or the email address you used to purchase so we can locate your account and verify it?

    Also, please share the affected URL so we can check and advise accordingly.

    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.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘index date problem’ is closed to new replies.