acf_get_verified_field_keys()
Returns the top-level field keys from submitted field lists that verify for any of the given render IDs.
A verified key proves the server rendered that field for the current user and object. It is evidence of rendering, not authorisation: the save handler still decides which render IDs and keys it accepts. No field lookups are made, so fields registered late (after the save handler runs) are still accepted.
Хуков нет.
Возвращает
array. The verified top-level keys.
Использование
acf_get_verified_field_keys( $lists, $render_ids );
- $lists(разное) (обязательный)
- The submitted lists, keyed by render ID (usually
$_POST['_acf_fields'], unslashed). - $render_ids(массив) (обязательный)
- The render IDs the save accepts.
Список изменений
| С версии 6.8.11 | Введена. |
Код acf_get_verified_field_keys() acf get verified field keys ACF 6.8.11
function acf_get_verified_field_keys( $lists, array $render_ids ) {
$keys = array();
if ( ! is_array( $lists ) ) {
return $keys;
}
foreach ( array_unique( array_map( 'strval', $render_ids ) ) as $render_id ) {
if ( '' === $render_id || empty( $lists[ $render_id ] ) || ! is_array( $lists[ $render_id ] ) ) {
continue;
}
foreach ( $lists[ $render_id ] as $field_list ) {
$keys = array_merge( $keys, _acf_get_verified_list_keys( $field_list, $render_id ) );
}
}
return array_values( array_unique( $keys ) );
}