From 2ea7fb9e331fdc230aed4830bc583708dc5254f5 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Mon, 24 Jul 2023 12:31:11 +0300 Subject: [PATCH] - fix counting words in a textarea field --- includes/core/um-actions-form.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 39eca33e..0d847b2e 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -573,7 +573,9 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { } if ( isset( $array['max_words'] ) && $array['max_words'] > 0 ) { - if ( str_word_count( $submitted_data[ $key ], 0, "éèàôù" ) > $array['max_words'] ) { + // count words without html tags + $without_tags = wp_strip_all_tags( $submitted_data[ $key ] ); + if ( str_word_count( $without_tags, 0, 'éèàôù' ) > $array['max_words'] ) { // translators: %s: max words. UM()->form()->add_error( $key, sprintf( __( 'You are only allowed to enter a maximum of %s words', 'ultimate-member' ), $array['max_words'] ) ); }