acf_filter_save_values() │ ACF 6.8.11

Returns submitted values restricted to the top-level keys a save may accept for an object.

Use for saves that pass values to acf_save_post() rather than saving $_POST['acf']. The save args are:

  • context (string): The save context, used in the acf/form/{$context}/allowed_field_keys filter.
  • post_id (integer|string): The ACF post ID being saved.
  • render_ids (array): The render IDs whose field lists the save accepts.
  • lists (array|null): The submitted field lists, keyed by render ID. Defaults to $_POST['_acf_fields'].
  • screen (array): The location screen args for keys submitted without a list. Empty accepts listed keys only.
  • filter_arg (mixed): The second argument of the filter. Defaults to post_id.
  • flat_clone_keys (boolean): Whether seamless clone sub fields may be submitted under their own keys (the datastore).

Хуков нет.

Возвращает

array.

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

acf_filter_save_values( $values, $args );
$values(разное) (обязательный)
The submitted values, keyed by top-level key.
$args(массив) (обязательный)
The save args.

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

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

Код acf_filter_save_values() ACF 6.8.11

function acf_filter_save_values( $values, array $args ) {
	if ( ! is_array( $values ) ) {
		return array();
	}

	return array_intersect_key( $values, array_flip( _acf_get_allowed_save_keys( array_keys( $values ), $args ) ) );
}