Home / Display Reading Time
Duplicate Snippet

Embed Snippet on Your Site

Display Reading Time

Add the estimated reading time before the post content.

500+
Code Preview
php
<?php
$reading_speed = 200; // 200 words per minute
$content       = get_post_field( 'post_content', get_the_id() );
$word_count    = str_word_count( strip_tags( $content ) );
$reading_time  = ceil( $word_count / $reading_speed );
echo '<p>Estimated reading time: ' . absint( $reading_time ) . ' ' . _n( 'minute', 'minutes', $reading_time ) . '</p>';

Comments

Add a Comment