public function set($post_id, string $key, array $values)
    {
        $post_id = (int) ($post_id ?? get_the_ID());

        if (!$post_id || !$key) {
            return; // Not possible.
        }
        $this->unset($post_id, $key);

        $key = $this->key($key);
        foreach ($values as $_value) {
            add_post_meta($post_id, $key, $_value);
        } // unset($_value); // Housekeeping.
    }
public function set($post_id, string $key, array $values)
    {
        $post_id = (int) ($post_id ?? get_the_ID());

        if (!$post_id || !$key) {
            return; // Not possible.
        }
        $this->unset($post_id, $key);

        $key = $this->key($key);
        foreach ($values as $_value) {
            add_post_meta($post_id, $key, $_value);
        } // unset($_value); // Housekeeping.
    }
public function set ( $ post_id , string $ key , array $ values ) { $ post_id = ( int ) ( $ post_id ?? get_the_ID ( ) ) ; if ( ! $ post_id || ! $ key ) { return ; // Not possible. } $ this -> unset ( $ post_id , $ key ) ; $ key = $ this -> key ( $ key ) ; foreach ( $ values as $ _value ) { add_post_meta ( $ post_id , $ key , $ _value ) ; } // unset($_value); // Housekeeping. }
Set meta values.

@since 160723 Post meta utils.

@param string|int|null $post_id Post ID; `null` = current.
@param string          $key     Meta key (unprefixed).
@param array           $values  Meta values.
Set meta values .