[Support request] How to remove dates from the Search results

Home Forums Support How to remove dates from the Search results

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1443465
    sanu kumar

    How to remove dates from the search results? I am using rank math SEO plugin and there is nothing like that option and I contact their support staff and they replied me this
    “The date is usually added by your theme and not Rank math. You will need to contact your theme support to help you remove this feature from your site.”

    #1443469
    Elvin
    Customer Support

    Hi,

    Can you take a look at this? This post may help you.
    https://generatepress.com/forums/topic/how-to-remove-date-preview-in-search-results/#post-944674

    Let us know if it works for you.

    A wise man once said:
    "Have you cleared your cache?"

    #1443471
    sanu kumar

    I want to remove the dates from search results (SERPs), not from the blog post.

    #1443476
    sanu kumar

    I have seen many sites who are using Generatepress and their results on Google doesn’t show dates but they have a dates on the blog posts.

    #1443818
    David
    Staff
    Customer Support

    Hi there,

    The problem is, we can remove the date tags from the site, and help to display a static non time stamped date on the post – but we cannot control how Google interprets that.

    when you say you have seen many sites where Date is displayed on site but not in SERPs. Can you share a link to one of them so we can see what they are doing ?

    #1444536
    Tom
    Lead Developer
    Lead Developer

    We can remove the microdata from the output, but then it’s up to Google whether they want to display the date or not (as David mentioned above).

    add_filter( 'generate_post_date_output', function() {
        $time_string = '<time class="entry-date published">%2$s</time>';
    
        if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
            $time_string = '<time class="updated">%4$s</time>' . $time_string;
        }
    
        $time_string = sprintf( $time_string,
            esc_attr( get_the_date( 'c' ) ),
            esc_html( get_the_date() ),
            esc_attr( get_the_modified_date( 'c' ) ),
            esc_html( get_the_modified_date() )
        );
    
        return sprintf( // WPCS: XSS ok, sanitization ok.
            '<span class="posted-on">%1$s<a href="%2$s" title="%3$s" rel="bookmark">%4$s</a></span> ',
            apply_filters( 'generate_inside_post_meta_item_output', '', 'date' ),
            esc_url( get_permalink() ),
            esc_attr( get_the_time() ),
            $time_string
        );
    } );
    #1508735
    sanu kumar

    Hello

    When we update our old post, there is a published date show on the search results, but what will we have to do to show the last updated date?

    Like this: https://ibb.co/28BtXYg

    For example; We wrote an article on 1st January 2018 (it means it is an original published date) and I have updated the post in regular intervals like 3rd March 2019 and so on till date and when someone search on Google and if my article shows on search results then the date shows the original published date i.e 1st January 2018 but I have seen many sites whose date shows last updated date, so how can I also do that? Is there any option in Rank Math?

    I have seen many sites who are using GP but their dates are showing last updated date on SERPs, could you help me with that what they are doing?

    Like I have shared one site in a private field.

    #1509122
    David
    Staff
    Customer Support

    Hi there,

    which site is displaying the incorrect date ? I can take a look to see what timestamps are being added to the site.

    Note: as we said before the Theme cannot control how Google determines the date to display.

    #1509159
    sanu kumar

    Have a look on this site: https://www.guideblogging.com/

    They are also using GP and I have seen their some post which was published last year which is its original published date and that same article shows in Search results with their last updated date like if they update their post recently then Google shows their recently updated date on search results

    But,

    In my case, my original published date is showing like my original published date was last year and I did some changes on a post and updated this year but Google shows the date on search results of last year which is an original published date.

    You can take a look at their site and see if they are doing something different.

    If Google controls this then leave it, I just asked because I have seen on other’s site but not on my site so that is why I asked.

    Thanks

    #1509247
    David
    Staff
    Customer Support

    I would need to see a post on YOUR site to see if it is declaring a Modified Date.

    #1509253
    sanu kumar
    #1509874
    David
    Staff
    Customer Support

    So your site contains both the published and modified time meta attributes but is set to only display the Updated date in the post content – so this is valid.

    If you want you can remove the Published dates altogether then you can use the snippet provided here:

    https://docs.generatepress.com/article/generate_post_date_show_updated_only/

    Other than that is is down to Googles bots and algorithms to determine whether it the SERP is worthy of an updated date.

    #1509897
    sanu kumar

    Could you help me with this – How do I remove Published dates

    #1509932
    David
    Staff
    Customer Support

    You simply need to add this PHP Snippet to your site:

    add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );

    This article explains adding PHP:

    https://docs.generatepress.com/article/adding-php/

    TLDR: Either add it to a Child Themes functions.php or use the Code Snippets plugin.

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.