ACF_Local_Meta::capture() public ACF 5.7.13
Returns a flattened array of meta for the given postdata. This is achieved by simulating a save whilst capturing all meta changes.
{} Это метод класса: ACF_Local_Meta{}
Хуков нет.
Возвращает
Массив.
Использование
$ACF_Local_Meta = new ACF_Local_Meta(); $ACF_Local_Meta->capture( $values, $post_id );
- $values(массив)
- An array of raw values.
По умолчанию: array() - $post_id(смешанный)
- The post_id for this data.
По умолчанию: 0
Список изменений
С версии 5.7.13 | Введена. |
Код ACF_Local_Meta::capture() ACF Local Meta::capture ACF 5.9.1
function capture( $values = array(), $post_id = 0 ) {
// Reset meta.
$this->meta[ $post_id ] = array();
// Listen for any added meta.
add_filter('acf/pre_update_metadata', array($this, 'capture_update_metadata'), 1, 5);
// Simulate update.
if( $values ) {
acf_update_values( $values, $post_id );
}
// Remove listener filter.
remove_filter('acf/pre_update_metadata', array($this, 'capture_update_metadata'), 1, 5);
// Return meta.
return $this->meta[ $post_id ];
}