acf/fields/max_appended_choices filter-hookACF 6.8.5

Filters the maximum number of choices that may be stored on a field via the checkbox save_custom, radio save_other_choice, and select save_options settings. Once reached, additional submitter-contributed values are not appended to the field definition. The submitter's own field value still saves to their post.

Usage

add_filter( 'acf/fields/max_appended_choices', 'wp_kama_acf_fields_max_appended_choices_filter', 10, 3 );

/**
 * Function for `acf/fields/max_appended_choices` filter-hook.
 * 
 * @param int            $max     Maximum number of choices.
 * @param array          $field   The field array holding all the field options.
 * @param integer|string $post_id The post_id of which the value will be saved.
 *
 * @return int
 */
function wp_kama_acf_fields_max_appended_choices_filter( $max, $field, $post_id ){
	// filter...
	return $max;
}
$max(int)
Maximum number of choices.
Default: 1000
$field(array)
The field array holding all the field options.
$post_id(int|string)
The post_id of which the value will be saved.

Changelog

Since 6.8.5 Introduced.

Where the hook is called

acf_field_select::append_user_choices_to_field()
acf/fields/max_appended_choices
acf_field_radio::update_value()
acf/fields/max_appended_choices
acf/includes/fields/class-acf-field-select.php 620
$max = (int) apply_filters( 'acf/fields/max_appended_choices', 1000, $field, $post_id );
acf/includes/fields/class-acf-field-radio.php 370
$max = (int) apply_filters( 'acf/fields/max_appended_choices', 1000, $field, $post_id );

Where the hook is used in Advanced Custom Fields PRO

Usage not found.