acf/form/comment/allowed_field_keys хук-фильтрACF 6.8.7

Filters the list of $_POST['acf'] keys a comment submission is allowed to save.

Use this to permit additional field keys when a developer dynamically injects fields into the comment form via JavaScript that aren't part of a field group whose location rules target this comment.

Использование

add_filter( 'acf/form/comment/allowed_field_keys', 'wp_kama_acf_form_comment_allowed_field_keys_filter', 10, 2 );

/**
 * Function for `acf/form/comment/allowed_field_keys` filter-hook.
 * 
 * @param array $keys       The allowed top-level $_POST['acf'] keys.
 * @param int   $comment_id The comment being saved.
 *
 * @return array
 */
function wp_kama_acf_form_comment_allowed_field_keys_filter( $keys, $comment_id ){

	// filter...
	return $keys;
}
$keys(массив)
The allowed top-level $_POST['acf'] keys.
$comment_id(int)
The comment being saved.

Список изменений

С версии 6.8.7 Введена.

Где вызывается хук

acf_form_comment::get_allowed_field_keys()
acf/form/comment/allowed_field_keys
acf/includes/forms/form-comment.php 314
$keys = apply_filters( 'acf/form/comment/allowed_field_keys', $keys, $comment_id );

Где используется хук в Advanced Custom Fields PRO

Использование не найдено.