WC_Data_Store_WP::add_meta()
Add new piece of meta.
Method of the class: WC_Data_Store_WP{}
No Hooks.
Return
Int
. meta ID
Usage
$WC_Data_Store_WP = new WC_Data_Store_WP(); $WC_Data_Store_WP->add_meta( $object, $meta );
- $object(WC_Data) (required) (passed by reference — &)
- WC_Data object.
- $meta(stdClass) (required)
- (containing ->key and ->value).
Changelog
Since 3.0.0 | Introduced. |
WC_Data_Store_WP::add_meta() WC Data Store WP::add meta code WC 9.4.2
public function add_meta( &$object, $meta ) { return add_metadata( $this->meta_type, $object->get_id(), wp_slash( $meta->key ), is_string( $meta->value ) ? wp_slash( $meta->value ) : $meta->value, false ); }