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

Home Forums Support How to remove dates from the Search results

Viewing 6 posts - 1 through 6 (of 6 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.

    #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
        );
    } );
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.