ACF_Local_Meta::capture
capture
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.
Список изменений
| С версии 5.7.13 | Введена. |
Код ACF_Local_Meta::capture() ACF Local Meta::capture ACF 6.4.2
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 ];
}