public function update($post_id, string $key, $value, $where = '')
    {
        $post_id = (int) ($post_id ?? get_the_ID());

        if (!$post_id || !$key) {
            return; // Not possible.
        }
        update_post_meta($post_id, $this->key($key), $value, $where);
    }
public function update($post_id, string $key, $value, $where = '')
    {
        $post_id = (int) ($post_id ?? get_the_ID());

        if (!$post_id || !$key) {
            return; // Not possible.
        }
        update_post_meta($post_id, $this->key($key), $value, $where);
    }
public function update ( $ post_id , string $ key , $ value , $ where = '' ) { $ post_id = ( int ) ( $ post_id ?? get_the_ID ( ) ) ; if ( ! $ post_id || ! $ key ) { return ; // Not possible. } update_post_meta ( $ post_id , $ this -> key ( $ key ) , $ value , $ where ) ; }
Update meta value.

@since 160723 Post meta utils.

@param string|int|null $post_id Post ID; `null` = current.
@param string          $key     Meta key (unprefixed).
@param mixed           $value   Meta value.
@param mixed           $where   (optional).
Update meta value .