After installing the Read Meter plugin on our site we realized there is a major issue: the Read Meter Plugin always displays 1 minute regardless of the length of the blog post. Fortunately, there is a easy fix for this.
Why Does Read Meter Always Display 1 minute?
If you are using a shortcode-based theme such as Divi the Read Meter 1 minute bug will present itself due to a bug in the plugin code. The plugin is trying to strip out all of the shortcodes as not to include them in the article word count, but a bug in the logic means that the entire article is removed if it’s wrapped in in a shortcode. This makes the plugin see zero words which defaults to a 1 minute read time. A quick analysis of the code shows that there should be an option on the Read Meter setup screen to disable this feature, but the option is missing from the screen.
Which Versions of Read Meter are affected by the 1 minute bug?
Ad of today (February 16th, 2021, the current version of Read Meter is 1.0.6. This plugin has been downloaded approximately 20k times.
How to fix the Read Meter 1 minute issue
Here is one way to make the plugin work. There are more elegant solutions, but this is quick and dirty and hopefully the appropriate setting will be added to the plugin in the near future.
I don’t recommend editing plugins. Do this at your own risk. Future updates will wipe out this change.
If you still want to proceed, here’s how to fix the Read Meter 1 minute bug:
Edit /classes/class-bsfrt-readtime.php and look on or about line 650 for something that looks like this:
1 2 3 |
if ( ! isset( $this->bsf_rt_options['include_shortcodes'] ) ) { //$bsf_rt_content = strip_shortcodes( $bsf_rt_content ); } |
Comment out the $bsf_rt_content = strip_shortcodes( $bsf_rt_content );
as shown above.
Note if you have many shortcodes this will artificially inflate the wordcount, so you may want to combat this by increasing the word-per-minute setting.
2 Comments
Where do i need to change that code? Somewhere in the theme file editor? Or in the functions.php?
I’m using the Salient Theme with WP-Bakery and it always shows 1 minute reading time. Please help
It would be done by editing the Read Meter plugin, specifically /classes/class-bsfrt-readtime.php.
Before you start, please see the note above about the dangers of editing a plugin file directly!