How to remove published dates from the Google SERP Resulst?

Can anyone help me to remove published dates from the Google SERP?

I don’t want to see them I want to replace with last updated date.

Any inputs will be highly appreciated.

Try this plugin: https://wordpress.org/plugins/wp-last-modified-info/

If you are using Genesis Framework. Add this code to your functions.php file of your child theme:

function sn_get_updated_date_for_post() {
    $date = '<i>' . get_the_modified_date() . '</i>'; 
    return $date;
}
add_shortcode( 'sn_modified_date', 'sn_get_updated_date_for_post' );
 
add_filter( 'genesis_post_info', 'sn_add_updated_date_info' );
function sn_add_updated_date_info($post_info) {
	$post_info = '[sn_modified_date] by [post_author_posts_link] [post_comments] [post_edit]';
	return $post_info;
}

Sorry I’m using GeneratePress theme, can i insert the same code?

1 Like

I’ve tried the plugin it’s been displaying latest updated date+published in the SERP, so i have removed it.

1 Like

Read this, It might help you https://generatepress.com/forums/topic/want-to-remove-published-date-from-search-engine-and-post/

For GeneratePress,

  1. Take backup
  2. Follow below steps

Add in the Theme functions.php

if ( ! function_exists( 'generate_posted_on' ) ) :
/**
 * Prints HTML with meta information for the current post-date/time and author.
 */
function generate_posted_on() 
{	
	$date = apply_filters( 'generate_post_date', true );
	$author = apply_filters( 'generate_post_author', true );
	//if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) 
		$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
	$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() )
	);
	
	// If our date is enabled, show it
	if ( $date ) :
		printf( '<span style="float: left; margin-right: 3px;">Updated:</span><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
			)
		);
	endif;
	
	// If our author is enabled, show it
	if ( $author ) :
		printf( ' <span class="byline">%1$s</span>',
			sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
				__( 'by','generatepress'),
				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() )
			)
		);
	endif;
	
}
endif;

Also add

.posted-on .updated {
 display: block;
 float:left; 
 margin-right: 3px;
}
1 Like

I am really sorry I read your query now, I was assuming you want to remove date from SERP. but you want to replace it with last updated date…

I have also done the same with my website because I am also using the GP.

Use the @GulshanKumar’s code How to remove published dates from the Google SERP Resulst?

But make sure to take backup and don’t add it in functions.php if you are not using a child theme. You can use a Hook element for adding this.

If this code doesn’t work for you then let me know I will share mine.

Thank you very much bro, I’ll add it

Many thank bro :slight_smile: I’’ try out the above code and let you know…

2 Likes

You’re welcome! :blush:

You’re welcome…