gform_checkbox_limit_max_message

Description

Allows to modify the message displayed when a checkbox is limited to a maximum number of choices.

Usage

add_filter( 'gform_checkbox_limit_max_message', 'your_function_name', 10, 3 );

Parameters

  • $message string
    The message to filter.
  • $max int
    The maximum number of choices that must be selected.
  • $field integer
    The field currently being processed.

Examples

Set a custom message for the Maximum Limit.

add_filter( 'gform_checkbox_limit_max_message', 'max_message', 10, 3 );
function max_message( $message, $number, $field ) {
	return 'You cannot choose more than ' . $number;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Gravity Forms 2.9.

Source Code

This filter is located in includes/fields/gf-field-choice.php