[Resolved] Last Update date do not update in google search snippet

Home Forums Support Last Update date do not update in google search snippet

This topic contains 9 replies, has 2 voices, and was last updated by  Tom 11 months, 1 week ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #421004

    Jhon Piter

    Hey

    I want to display Last Update date in my post and also google search snippet. For this, I added that CSS in my child theme stylesheet

    ————————————

    .posted-on .updated {
    display: inline-block;
    }
    .posted-on .published {
    display: none;
    }

    .posted-on .updated:before {
    content: “Last updated: “;
    }

    ————————————

    Everything was fine. Display Last Update Date in my posts and few days later after recrowl googlebot It will show also in google search snippet.

    But from last 2-3 days, I notice show published date in google search snippet again but in my posts show Last Update date.

    I mean Last Update date in google search not stay. After Few days display post published date.

    Please check both screenshots for better understand my problem.

    https://prnt.sc/h8t0rm
    https://prnt.sc/h8t1o3

    How Can I solve this?

    This issue is very important for my site.

    Thanks

    GP Premium 1.5.1
    #421121

    Jhon Piter

    I check structure data “hatom” tab and find here is display

    Link – https://search.google.com/structured-data/testing-tool?url=https://thedearlab.com/best-knee-pads/#url=https%3A%2F%2Fthedearlab.com%2Fbest-knee-pads%2F

    Screenshot Link – https://prnt.sc/h8vbyp

    .posted-on .published {
    display: none;
    }

    This CSS property display none I mean hide published date from my website posts but not able to hide from structure data. Maybe for this reason on google search result show published date. Not sure, you are expert so you can find a proper reason.

    If It is right point, how can I hide published date from structure data?

    #421166

    Jhon Piter

    One more info, I was using this rich snippet plugin

    https://wordpress.org/plugins/all-in-one-schemaorg-rich-snippets/

    can It cause problems?

    I already deactivate this plugin and save again my post but still show both (publish/Update) date in structure data.

    #421189

    Tom Lead Developer

    It looks like the last update date is displaying fine, and the structured data looks fine (the testing tool shows the last updated date just fine).

    In this case I think it’s just up to Google to display the updated date over the published date – the best thing you can do is add structured data to the elements, which you’ve already done.

    #421195

    Jhon Piter

    Hey Tom

    Is It possible to keep only Update date in markup?

    I do not want to keep published date because I monitor my keyword on google last few days.

    WHen shows Update date in search snippet keyword ranked up.
    So I am very tense about this issue.
    And I see few site html markup who do not use published date like

    https://www.cloudliving.com/seo-powersuite-review/

    Is It any problem If I do not use published date?

    Please send me code like my current format

    Last Update Date | Author image | Author name

    Thanks

    #421306

    Tom Lead Developer

    Are you currently using any code for the byline? I see you have the gravatar in there, so it would be best if I could see what you have already and edit it.

    Let me know 🙂

    #421311

    Jhon Piter

    Hey Tom

    Here is the code

    ———————————————————-

    add_filter( ‘generate_post_author_output’, ‘tu_add_author_gravatar’ );
    function tu_add_author_gravatar() {
    printf( ‘ <span class=”byline”>%1$s</span>’,
    sprintf( ‘<span class=”author vcard” itemtype=”http://schema.org/Person” itemscope=”itemscope” itemprop=”author”>%4$s</span>’,
    esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
    esc_attr( sprintf( __( ‘View all posts by %s’, ‘generatepress’ ), get_the_author() ) ),
    esc_html( get_the_author() ),
    get_avatar( get_the_author_meta( ‘ID’ ) )
    )
    );

    }

    #421352

    Tom Lead Developer

    Try adding this function:

    add_filter( 'generate_post_date_output', 'tu_no_published_date' );
    function tu_no_published_date() {
        $time_string = '';
        if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
            $time_string .= '<time class="updated" datetime="%1$s" itemprop="dateModified">%2$s</time>';
        }
    
        $time_string = sprintf( $time_string,
            esc_attr( get_the_modified_date( 'c' ) ),
            esc_html( get_the_modified_date() )
        );
    
        printf( '<span class="posted-on">%1$s</span>',
            sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
                esc_url( get_permalink() ),
                esc_attr( get_the_time() ),
                $time_string
            )
        );
    
    }
    #421428

    Jhon Piter

    Wow! It works like a charm. You are really helpful.

    Thank you so much, Tom

    #421756

    Tom Lead Developer
Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.