Change the Word Count Labels

Modify the word count labels displayed for all fields.

Code

Filename: gpwc-change-word-count-labels.php

<?php
/**
 * Gravity Perks // Word Count // Change the Word Count Labels
 * https://gravitywiz.com/documentation/gravity-forms-word-count/
 *
 * Modify the word count labels displayed for all fields.
 */
add_filter( 'gpwc_script_args', 'gpwc_modify_script_args', 10, 3 );
function gpwc_modify_script_args( $args, $field, $form ) {

	$args['defaultLabel']       = '{count} / {limit}';
	$args['counterLabel']       = '{count} / {limit}';
	$args['limitReachedLabel']  = '<span style="font-weight:bold">{count} / {limit}</span>';
	$args['limitExceededLabel'] = '<span style="font-weight:bold;color:#f00">{count} / {limit}</span>';

	return $args;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.