Atenção!

Este artigo contém código PHP e destina-se a desenvolvedores. Oferecemos este código como uma cortesia, mas não fornecemos suporte para personalizações de código ou desenvolvimento de terceiros.

Para orientação extra, consulte o tutorial do WPBeginner sobre como adicionar código personalizado.

Dispensar

Descrição

The wpforms_frontend_strings filter is used to change the string text that appears when limiting characters or words inside a Single Line Text or Paragraph Text form field.

Parâmetros

$strings
(string) String text used to display a message of how many remaining characters (or words) left when limiting the text of the form field.

Fonte

wpforms/src/Frontend/Frontend.php

Mais Informações

The filter is used to change the string text message that appears below the Single Line Text or Paragraph Text form fields when limiting either the character or word counts.

Exemplo

/**
 * Limiting character or word display message.
 *
 * @link   https://wpforms.com/developers/wpforms_frontend_strings
 *
 * @param  string $strings  String text used to display message under the form field when limiting character or word count.
 * @return string
 */

function wpf_dev_frontend_strings( $strings ) {
     
    // val_limit_words to be used when limiting words
    // val_limit_characters to be used when limiting characters   
     
    $strings[ 'val_limit_characters' ] = __( 'You have used {count} out of the {limit} characters allowed.', 'plugin-domain' );

    return $strings;
}

add_filter( 'wpforms_frontend_strings' , 'wpf_dev_frontend_strings', 10, 1 );

Artigos de Referência

Como Alterar o Texto de Validação de Limite de Caracteres