Hi there!
I’m currently using this code to show the updated date of the article:
add_filter('generate_post_date_show_updated_only', '__return_true');
add_filter('generate_post_date_output','gp_add_to_post_date');
function gp_add_to_post_date($output) {
return 'Updated on ' . $output;
}
And this to show the reading time of the post:
function tu_estimated_reading_time() {
$post = get_post();
$content = $post->post_content;
$wpm = 300; // How many words per minute.
$clean_content = strip_shortcodes( $content );
$clean_content = strip_tags( $clean_content );
$word_count = str_word_count( $clean_content );
$m = ceil( $word_count / 200 );
if($m < 2) {
$time = '1 min';
} else {
$time = $m . ' min';
}
return $time;
}
add_filter( 'generate_post_author_output', function( $output ) {
$output .= '<span class="read-time">— ' . tu_estimated_reading_time() . ' read </span>';
return $output;
} );
This gives me the following result:
Updated on 29 November 2022 by John Doe — 3 min read
How can I remove the ‘by John Doe’ part, since I’m the only author on the website? And would this negatively impact SEO in any way?
I’ve tried to uncheck ‘Display post author’ in the customizer, but the estimated reading time would then be gone too.
Thanks!