WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#4807 closed enhancement (fixed)

Word Count

Reported by: mdawaffe Owned by: mdawaffe
Milestone: 2.6 Priority: normal
Severity: minor Version: 2.3
Component: Administration Keywords: has-patch blessed
Focuses: Cc:

Description

Add word count thingummy to the Write Post screen. Should work in Visual view, Code view and tinyMCE-just-plain-off view.

Patch accomplishes this in Firefox, Safari, IE6/7, Opera.

Is it core?

Attachments (6)

4807.diff (3.3 KB) - added by mdawaffe 7 years ago.
4807b.diff (3.5 KB) - added by mdawaffe 7 years ago.
patch update: this is what's currently running on WP.com
word-count.patch (6.5 KB) - added by azaozz 6 years ago.
word-count2.patch (6.6 KB) - added by azaozz 6 years ago.
word-count3.patch (6.4 KB) - added by azaozz 6 years ago.
word-count3.2.patch (6.3 KB) - added by azaozz 6 years ago.

Download all attachments as: .zip

Change History (47)

mdawaffe7 years ago

comment:1 Stevie2127 years ago

  • Priority changed from normal to low
  • Severity changed from normal to trivial

Try the ideas section to pledge your idea, Go here It's trivial if we need it or not, thats why I am changing it to "low" however it is a good idea.

comment:2 Viper007Bond7 years ago

-1

I don't really see the point. I mean who cares how many words are in your post? I bet 99% of people don't.

Best left to a plugin IMO.

comment:3 rob1n7 years ago

I'm on the fence with this one. While it's cool and I can definitely see the use (and I'd probably pay attention to it when I'm writing a post), I question whether it's really something that a wide range of users will use. But then again, it's unobtrusive enough that I also can't decide if it's plugin material or just a trivial addition to the core.

comment:4 rob1n7 years ago

  • Keywords has-patch 2nd-opinion added

comment:5 JeremyVisser7 years ago

+1. WordPress.com has this feature.

comment:6 follow-up: jaroche7 years ago

-1.

Really, i don't see why have this in wordpress editor. If i wanna have a word counter and other goodies, I gonna use a real word procesor.

comment:7 in reply to: ↑ 6 JeremyVisser7 years ago

Replying to jaroche:

Really, i don't see why have this in wordpress editor. If i wanna have a word counter and other goodies, I gonna use a real word procesor.

That's true. Word count is a small feature of a word processor. If we include word counting, then we're showing favouritism by not also turning it into a mini word processor.

(Oh boy, I wrote 'word processor' twice. Both times, I actually wrote 'WordPress', then had to hit backspace and correct it.) :)

mdawaffe7 years ago

patch update: this is what's currently running on WP.com

comment:8 mdawaffe7 years ago

  • Owner changed from anonymous to mdawaffe
  • Status changed from new to assigned

Patch updated.

As an aside, since this is completly JS, the feature can be easily disabled by plugin with the following.

wp_deregister_script( 'word-count' );

(Not a mark for/against the idea, just an FYI.)

comment:9 matt7 years ago

+1 in new implementation.

comment:10 Otto427 years ago

+1. I see no issues with it being on the write page. Okay, so it's bling, but users notice bling. And given that this is extremely minor bling, I'm for it.

comment:11 johnbillion7 years ago

-1. Surely plugin territory. I don't see how this is of any interest to 99% of users.

comment:12 johnbillion7 years ago

Although I -1'd it, I've been testing anyway and there are a couple of bugs with 4807b:

  • Write two or more words, word count is immediately out by one.
  • Write any amount of text, delete some and continue writing, word count is now very wrong.

Trunk at r6054, Firefox 2.0 on Vista, applies to RTE and non-RTE. Affects WP.com too.

comment:13 markjaquith7 years ago

-1 for core. The vast majority of people don't care. Blogs are supposed to liberate writers from the draconian word-count restrictions of their print ancestors.

Plugin.

comment:14 filosofo7 years ago

-1. It seems like a great idea for a plugin. Most users don't care, and those who do probably won't be satisfied anyways unless the count appears publicly.

comment:15 PaulGregory6 years ago

Can I solve the plugin/core dilemma with the "on the fence" solution?

Surely everyone would be happy with:
+1 for Plugin Distributed With Core, like Dolly. Not active by default.

Obviously, only if the plugin is actually adding things up correctly...

comment:16 davidszp6 years ago

+1. I currently use a plugin for this but would love to have it built in. It helps me get a feel for when to stop writing (as I can be wordy). Right now will work for this comment... :-)

comment:17 hansengel6 years ago

+1. I'm sure many people would appreciate a word-counter for many different reasons... if they are posting essays that must be a certain length, et cetera.

comment:18 sillybean6 years ago

I have a word count script that might be of use. It counts correctly, but I'm still learning JS and I don't know yet how to work around IE's broken event handling. Works great in other browsers.

comment:19 johnbillion6 years ago

  • Keywords needs-patch added; has-patch removed

Changing to needs-patch. With the current patch, the live update count becomes incorrect once any text has been deleted.

comment:20 pishmishy6 years ago

  • Milestone changed from 2.5 to 2.6

-1.
There's enough debate to conclude that the feature is in plugin territory. I can see how it may be useful to some authors but I don't see it as something that most blog authors would find useful. I'm going to recommend closing, in any case it should be bumped to 2.6

comment:21 markjaquith6 years ago

  • Milestone 2.6 deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

comment:22 michaelpark6 years ago

  • Milestone set to 2.5.1
  • Priority changed from low to normal
  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Version changed from 2.3 to 2.5

I'm in need of this for 2.5. Could anyone update this patch?

comment:23 follow-up: ffemtcj6 years ago

  • Milestone 2.5.1 deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

This was closed as wontfix. If you need this, you could make a plugin for it.

comment:24 Viper007Bond6 years ago

  • Priority changed from normal to low
  • Version changed from 2.5 to 2.3

comment:25 in reply to: ↑ 23 michaelpark6 years ago

Replying to ffemtcj:

This was closed as wontfix. If you need this, you could make a plugin for it.

I would if I could. :(

comment:26 DavidSzp6 years ago

There is a plugin that does word counting already (but not live, just on save) called Word Statistics, and it also shows some readability numbers as well. I use it on 2.5 and it seems to work fine.

comment:27 follow-up: azaozz6 years ago

  • Keywords has-patch added; needs-patch 2nd-opinion removed
  • Milestone set to 2.5.1
  • Priority changed from low to normal
  • Resolution wontfix deleted
  • Severity changed from trivial to minor
  • Status changed from closed to reopened

Adapted the script from 4807b for WordPress 2.5/TinyMCE 3, also changed the counting regexp to make it faster and added re-counting on pressing Backspace.

azaozz6 years ago

comment:28 in reply to: ↑ 27 ; follow-up: michaelpark6 years ago

THANK YOU!

comment:29 in reply to: ↑ 28 azaozz6 years ago

Replying to michaelpark:

THANK YOU!

You're welcome, but it was Matt's idea.

comment:30 follow-up: michaelpark6 years ago

Count reduction by pressing Backspace key doesn't seem to work, and it's counting punctuations as words if they are followed by a space.

comment:31 in reply to: ↑ 30 azaozz6 years ago

Replying to michaelpark:

Count reduction by pressing Backspace key doesn't seem to work, and it's counting punctuations as words if they are followed by a space.

It re-counts on pressing a key after pressing backspace, so if you delete something by holding down backspace, it will re-count when you start typing again. Same as when typing: it increases the count after pressing the space bar, not when it's pressed.

Yes, special characters/punctuation is counted as a word if it's separate from the end of the previous word. So "Hello!" would be 1 word, but "Hello !" would be 2 words. As far as I can tell all word counting works this way (is separate punctuation considered words? Perhaps non-verbal form of expression? Is this a word " :-) "?).

comment:32 michaelpark6 years ago

No, it's not a word. Words should be consist of only alphabets -- no numbers or punctuations.

azaozz6 years ago

comment:33 azaozz6 years ago

OK, fixed. Now it only counts words consisting of letters or mixed letters/numbers, no numbers only or any punctuation/special characters. Still supports all extended ASCII characters, like è, é, ë, ñ, ü, etc.

comment:34 follow-up: michaelpark6 years ago

Hmmm, I think it's still counting punctuations as words.

comment:35 in reply to: ↑ 34 azaozz6 years ago

Replying to michaelpark:

Hmmm, I think it's still counting punctuations as words.

Now it strips all characters except the letters and spaces before counting. While typing, it still increases the count on every pressing of the spacebar (as it did before), so the count would go higher if typing numbers for example, but then it's corrected when pressing Enter or after pressing Backspace.

It's not practical to re-count on every pressing of the spacebar as in large posts with a lot of HTML tags on slower computers it would interfere with the speed of typing.

The alternative would be to disable the increase of the count on pressing the spacebar and to update it only on Enter and after Backspace (at the end of each paragraph).

Also tried to make it remember the position of the last full re-count (user pressed Enter), then count only the extra words after that on each pressing of the spacebar (the current paragraph). That would make it more accurate while typing, but if the user goes back and deletes some text, then continues typing without triggering full re-count, it still would be wrong. Can put this back in.

comment:36 michaelpark6 years ago

That's a good idea actually. I can live with having to press enter.

Thanks again!

comment:37 matt6 years ago

  • Keywords blessed added
  • Milestone changed from 2.5.1 to 2.6

azaozz6 years ago

comment:38 azaozz6 years ago

Simplified it a bit: now counts only on Enter, or after Backspace or Delete keys are pressed. The word count is updated less frequently but is always right.

azaozz6 years ago

comment:39 michaelpark6 years ago

2.5.1 doesn't have this, right?

Feature Request: An option to specify the number of seconds for re-count regardless of when Enter, Backspace and Delete keys are pressed. Or, re-count on automatic save.

comment:40 ryan6 years ago

(In [7854]) Word count from azaozz. see #4807

comment:41 ryan6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.