Skip to content

WordPress – Estimated Reading Time

I have a theme coming out soon that displays the ‘estimated reading time’ for each blog post on the homepage.

The theme is inspired by the new blogging service Medium – but I first saw the idea mentioned on Brian Crays blog. I thought it was a really nice thing to add – and the idea that people are more likely to read an article when they know how long it is was quite appealing (in fact I am now wondering if I should add it on this site as well).

Anyway – the code was quite simple – so I turned it into an easily reusable function, as seen below.

All the code does is calculate the number of words in the article, and then assign a number of seconds per word. It’s very simple but gives quite nice results.

 * Estimate time required to read the article
 * @return string
function bm_estimated_reading_time() {

	$post = get_post();

	$words = str_word_count( strip_tags( $post->post_content ) );
	$minutes = floor( $words / 120 );
	$seconds = floor( $words % 120 / ( 120 / 60 ) );

	if ( 1 < = $minutes ) {
		$estimated_time = $minutes . ' minute' . ($minutes == 1 ? '' : 's') . ', ' . $seconds . ' second' . ($seconds == 1 ? '' : 's');
	} else {
		$estimated_time = $seconds . ' second' . ($seconds == 1 ? '' : 's');

	return $estimated_time;


I'll be posting about the theme in question the future - so I'll point it out then 🙂

The theme in question is called Kent and it's now available to buy on You can check out the Kent demo here.

Ben View All

Ben is a lifelong Nintendo fan who also likes to build websites, and develop games. He also buys way too much Lego.

13 thoughts on “WordPress – Estimated Reading Time Leave a comment

  1. Pingback: WordPress – Estimated Reading Time
  2. Simple but effective, I would think. Remember seeing this feature on certain news sites sometime ago but had discontinued. Wonder if there’s a way to get this info on Google search listing info (just like the star buttons). For example, against a search result if it has a 5 star along with a reasonable reading of say 3 minutes, the CTR might just increase.

    Any thoughts?

  3. That’s cool, I’ll probably add it to my site, thanks!

    Just curious, how did you come up with the 120 words per minute? Is that a standard?

  4. Very handy addition to a theme. The need to call get_post() could be eliminated by using the ‘the_content’ filter:

    function bm_estimated_reading_time($content){ 
        //The logic
    		$content .= "";
    	return $content;
    add_filter('the_content', 'bm_estimated_reading_time');
    • That’s a good option if you want it added at the end of the post data for sure. I like to be able to mix up the location of the text though – so a separate function gives me that flexibility.

  5. I tried this code and it’s not working anymore. Is there any update to have it work with the latest version of WordPress?

    • Hi Jesse – that’s strange. It definitely still works. You can see it in action in the theme linked in the article.

  6. Great Post!

    Following your post we’ve published a post not too long ago explaining how to create a WordPress plugin which display’s the estimated reading time (In Hebrew only at the moment).

    Hope that Hebrew sites owner’s will find it useful… 🙂

  7. Hi thanks for this great tutorial.
    put just to ask can your code be used for commercial purpose without any licensing issues?
    I would like to use it for a major project, so I opt to ask first.


    • Hi Lawrence – thanks for the message. You’re more than welcome to use the code in your own projects.

      Thanks! Ben

Leave a Reply

Your email address will not be published. Required fields are marked *