Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My editors reported that there appears to be an issue with my word count on the post edit page. Testing this proved true, check the word count:

wordcount

This is affecting all posts, for instance, a post with around 1600 words shows as 8000+ words.

My question is, what can be the cause of this? How do I troubleshoot this and find a solution? Is anyone else experiencing similar issue on Wordpress v3.5.1? I am baffled...

Update: Appears it calculates characters (instead of words). It sums all letters without spaces. It doesn't count periods or other symbols either. Now, this is getting obscure.

Update 2: The perks of moving servers. Once moving server, I could start debugging this issue on the old server to find the cause. So I deactivated all plugins, same problems. Finally, I found this code hiding in the theme of which I used as a template:

// Tells wp_trim_words() function to use characters instead of words
function et_wp_trim_words_to_characters( $default_translated_text, $original_text, $context ) {
    if ( 'words' == $original_text && 'word count: words or characters?' == $context ) {
        return 'characters';
    }

    return $default_translated_text;
}
add_filter( 'gettext_with_context', 'et_wp_trim_words_to_characters', 20, 3 );

My question is, what would be the purpose of this code? I suspect that it was not intended to conflict with the word count on the post edit page.

share|improve this question
    
Have you tried to deactivate all plugins? I've checked this on my local install and can not reproduce mentioned "bug". Have you noticed that the word count value corresponds to the letter count? –  david.binda Feb 11 '13 at 21:11
    
It is certainly very bizarre. This is a live site and highly trafficked, deactivating plugins here and there and emptying functions will be difficult. It would be easier if I knew somewhere to start... –  Christine Cooper Feb 11 '13 at 21:13
    
Than try to move the site to localhost and do your tests there... –  david.binda Feb 11 '13 at 21:17
    
@david.binda You were right about it counting letters, question edited. –  Christine Cooper Feb 11 '13 at 21:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.