I at the moment have 11 posts and the whole phrase depend proven within the Gutenberg editor after clicking the āiā icon above the writing space is 2,342 phrases. I manually added it up. The phrases within the title are 151 phrases for all 11 posts.
So the grand whole is 2493 phrases.
Nonetheless, this code beneath reveals that there are 3,868 phrases.
What’s unsuitable right here?
operate getWordCountFromPosts () {
$depend = 0;
$posts = get_posts( array(
'numberposts' => -1,
'post_type' => 'any'
));
foreach( $posts as $put up ) {
$depend += str_word_count( strip_tags( get_post_field( 'post_content', $post->ID )));
}
$num = number_format_i18n( $depend );
return $num;
}
I displayed the consequence utilizing
<?php echo getWordCountFromPosts(); ?>

