• Resolved fonnte

    (@fonnte)


    hi again tom,

    is there any way to remove date from google search result? i create evergreen contents and i am hoping to display date for visitor not for search result

    thanks tom.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Tom

    (@edge22)

    You could try removing the microdata from the date, but Google might be smart enough to grab it anyways:

    add_filter( 'generate_post_date_output','tu_remove_date_microdata' );
    function tu_remove_date_microdata() {
    	$time_string = '<time class="entry-date published">%2$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() )
    	);
    	
    	printf( 
    		'<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		$time_string
    	);
    }

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

    Thread Starter fonnte

    (@fonnte)

    thanks a lot tom!

    Theme Author Tom

    (@edge22)

    You’re welcome ??

    you could also try this code and put in your functions.php

    `function mb_remove_post_date() {
    add_filter(‘the_time’, ‘__return_false’);
    add_filter(‘the_date’, ‘__return_false’);
    add_filter(‘the_modified_date’, ‘__return_false’);
    }
    add_action(‘loop_start’, ‘mb_remove_post_date’);

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove date from SERP’ is closed to new replies.