ACF_Local_Meta::add
add
Adds postmeta to storage. Accepts data in either raw or request format.
Метод класса: ACF_Local_Meta{}
Хуков нет.
Возвращает
Массив.
Использование
$ACF_Local_Meta = new ACF_Local_Meta(); $ACF_Local_Meta->add( $meta, $post_id, $is_main );
- $meta(массив)
- An array of metdata to store.
По умолчанию: array() - $post_id(разное)
- The post_id for this data.
- $is_main(true|false)
- Makes this postmeta visible to get_field() without a $post_id value.
По умолчанию: false
Список изменений
| С версии 5.8.0 | Введена. |
Код ACF_Local_Meta::add() ACF Local Meta::add ACF 6.4.2
function add( $meta = array(), $post_id = 0, $is_main = false ) {
// Capture meta if supplied meta is from a REQUEST.
if ( $this->is_request( $meta ) ) {
$meta = $this->capture( $meta, $post_id );
}
// Add to storage.
$this->meta[ $post_id ] = $meta;
// Set $post_id reference when is the "main" postmeta.
if ( $is_main ) {
$this->post_id = $post_id;
}
// Return meta.
return $meta;
}