WordPress

How to Add a Reading Time Estimate to Your WordPress Blog Posts

How to Add a Reading Time Estimate to Your WordPress Blog Posts

Why Add a Reading Time to Your Posts?

Adding a reading time estimate enhances user experience and boosts engagement. It helps readers decide if they want to dive in now or bookmark for later. Plus, it’s a nice touch for content-heavy blogs.

You’ve probably seen something like this:

🕒 Reading time: 4 minutes

Let’s add that to your WordPress posts — the clean, developer-friendly way.


Step 1: Add the PHP Function to Calculate Reading Time

Edit your theme’s functions.php file or a custom plugin and add:


function get_reading_time($post_id = null) {
  $post_id = $post_id ?: get_the_ID();
  $content = get_post_field('post_content', $post_id);
  $word_count = str_word_count(strip_tags($content));
  $reading_time = ceil($word_count / 200); // 200 wpm average
  return $reading_time . ' min read';
}

What It Does: It calculates word count, divides by 200 (average reading speed), and rounds up.


Step 2: Display Reading Time in Your Theme

Now, insert the reading time into your post template. Edit single.php, content.php, or wherever you want it to appear:


<div class="reading-time">
  🕒 <?php echo get_reading_time(); ?>
</div>

Put it above the post title, below it, or right before the content — wherever it fits best visually.


Optional: Style It with CSS


.reading-time {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

You can also add an icon, change the wording, or use a bold badge style.


Bonus: Add Support for Custom Post Types

To show reading time on custom post types (like articles or projects), just make sure you call get_reading_time() within the loop on their templates too.


Alternative: Use a Lightweight Plugin

Prefer plugins? Try:

Still, custom code is faster, lighter, and gives you full design control.


Conclusion

Adding a reading time estimate to WordPress is a subtle but effective UX boost. It’s easy to implement, improves readability, and shows respect for your readers’ time. Whether you’re running a blog, magazine, or tutorial site — this small detail goes a long way.