How to calculate Average Post Read Time

About Research on Plugin

We can add a plugin for estimating Post Reading Time in WordPress. The easiest way to add estimated post-reading time is by using the Read Meter plugin. It’s a free WordPress plugin that helps you show the reading time and progress bar on your website.

First, activate the Read Meter plugin. Upon activation, you need to visit the Settings » Read Meter page from your WordPress admin panel to configure the plugin settings.

Post-reading time functionality without plugin

We can develop a function that calculates the read time of each post. A sample code attaching below:
//estimated reading time

function reading_time() {

$content = get_field(‘post_description_field_1’, $post->ID);

$word_count = str_word_count( strip_tags( $content ) );

$readingtime = ceil($word_count / 200);

if ($readingtime == 1) {

$timer = ” minute”;

} else {

$timer = ” minutes”;

}

$totalreadingtime = $readingtime . $timer;

return $totalreadingtime;

}

Function can be define in functions.php. Here, we are calculating the average time of a person that reads 200 words per minute.

Leave a comment

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