Bug Report: Estimated Reading Time not working for Cyrillic/Bulgarian

Posted in: Newspaper
Post count: 23

Hello tagDiv Support Team,

I would like to report a bug regarding the Estimated Reading Time calculation in the Newspaper theme.

The Problem:
Currently, the theme uses the PHP function str_word_count() to calculate the number of words in a post. However, this function is not compatible with multi-byte characters and does not recognize Cyrillic scripts (like Bulgarian, Russian, etc.). As a result, for all Cyrillic posts, the word count returns 0, and the reading time always displays “Less than 1 minute,” regardless of the actual length of the article.

The Fix:
To make this feature world-ready and compatible with all languages, please replace the str_word_count() call with a regex-based approach that supports UTF-8.

Current code in your files:

PHP
$post_content_word_count = str_word_count( wp_strip_all_tags($post_content) );

Recommended fix (High performance & UTF-8 compatible):

PHP
$post_content_word_count = preg_match_all('/\p{L}+/u', wp_strip_all_tags($post_content));

Why this fix?

\p{L} matches any letter from any language (including Cyrillic, Greek, Arabic, etc.).

The /u modifier ensures the string is handled as UTF-8.

Performance: preg_match_all is extremely fast and has negligible impact on server load.

This small change will fix the issue for thousands of your international users. Could you please consider implementing this fix in the next update of the theme?

Best regards,

Post count: 23

I forgot to write the file for reference:

/plugins/td-cloud-library/state/single/tdb_state_single.php

Post count: 35449

Hi,
Thank you for letting us know about this. I’ve passed it on to our developers, and they will review and address it in an upcoming theme update.
Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.