/**
* Gravity Perks // Pay Per Word // Surprise, Pay Per Character!
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/
*/
gform.addFilter( 'gpppw_word_count', function( wordCount, text, gwppw, ppwField, formId ) {
// Pay per character instead of words.
var words = text.split( '' );
return words == null ? 0 : words.length;
} );
<?php
/**
* Gravity Perks // Pay Per Word // Surprise, Pay Per Character!
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/
*/
add_filter( 'gpppw_word_count', function( $word_count, $words ) {
$words = str_split( trim( $words ) );
return count( $words );
}, 10, 2 );