WC_Data::save_meta_data()
Update Meta Data in the database.
Метод класса: WC_Data{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$WC_Data = new WC_Data(); $WC_Data->save_meta_data();
Список изменений
С версии 2.6.0 | Введена. |
Код WC_Data::save_meta_data() WC Data::save meta data WC 7.3.0
public function save_meta_data() { if ( ! $this->data_store || is_null( $this->meta_data ) ) { return; } foreach ( $this->meta_data as $array_key => $meta ) { if ( is_null( $meta->value ) ) { if ( ! empty( $meta->id ) ) { $this->data_store->delete_meta( $this, $meta ); unset( $this->meta_data[ $array_key ] ); } } elseif ( empty( $meta->id ) ) { $meta->id = $this->data_store->add_meta( $this, $meta ); $meta->apply_changes(); } else { if ( $meta->get_changes() ) { $this->data_store->update_meta( $this, $meta ); $meta->apply_changes(); } } } if ( ! empty( $this->cache_group ) ) { $cache_key = self::generate_meta_cache_key( $this->get_id(), $this->cache_group ); wp_cache_delete( $cache_key, $this->cache_group ); } }