block_core_post_time_to_read_word_count
block_core_post_time_to_read_word_count ( $text, $type )
Parameters:- (string) text Text to count elements in.
- (string) type The type of count. Accepts 'words', 'characters_excluding_spaces', or 'characters_including_spaces'.
Returns:- (string) The rendered word count.
Defined at: - Introduced in WordPress: 6.9.0
- Deprecated in WordPress: —
Description
Counts words or characters in a provided text string.This function currently employs an array of regular expressions
to parse HTML and count words, which may result in inaccurate
word counts. However, it is designed primarily to agree with the
corresponding JavaScript function.
Any improvements in the word counting, for example with the HTML API
and {@see} should coordinate
with changes to the JavaScript implementation to ensure consistency
between the editor and the rendered page.