Documentation

gwp_word_count

The gwp_word_count Gravity Forms Merge Tag Modifier counts the number of words in a string value. This can be handy when you want to count the number of Words for calculating translation costs or to show quickly if the number of used words are fitting a specific content template (like an essay).

:gwp_word_count

Examples

{Text:1:gwp_word_count}
Example valueModifier result
GravityWP Advanced Merge Tags4
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.19
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?129

Use the word count in calculations

The gwp_word_count merge tag modifier can be used in calculations as well. For example, you can use it to calculate the cost of translating a piece of text based on the number of words.

Suppose you charge $0.10 per word for translation services. You can use the gwp_word_count modifier to calculate the cost of translating a piece of text by multiplying the result of the modifier by 0.10. Just add this formula to the calculation setting of a number field:

{Text:1:gwp_word_count} * 0.10

Frequently Asked Questions

Can I use the word count result in a calculation field?

Yes, you can! Simply enable calculation in a Number field and use the word count merge tag as part of your formula. For example, if you charge $0.10 per word, you can calculate the cost like this:

{Paragraph Text:1:gwp_word_count} * 0.10

Will it work with Rich Text Editor (RTE) fields?

Yes. If you’re using a Paragraph Text field with Rich Text Editor enabled, the modifier will strip all HTML tags and only count visible words so formatting won’t affect the total.

{Paragraph Text:3:gwp_word_count}

Can I count hyphenated or special-separated words differently?

Yes. Use the additional_separators attribute to define extra characters as word boundaries. For example, to count “apple-banana-orange” as 3 words:

{Single Line Text:2:gwp_word_count additional_separators="-"}

What happens if the field is empty or fails to count?

If the field is blank or contains no valid words, the merge tag returns 0. If there’s an internal error, it may return an error message or nothing depending on plugin settings.

{Paragraph Text:1:gwp_word_count}

Last updated: 22-07-2025

Advanced Merge Tagsv1.9.3

To use the functionalities described in this documentation, you'll need to get the GravityWP - Advanced Merge Tags add-on.

Read more