Ejemplo n.º 1
0
/**
 * Remove a tag term by name or id
 *
 * @api
 * @since 1.2
 *
 * @param mixed $tag (required) int tag term_id or string tag name
 * @return bool true on success, false on failure
 **/
function shopp_rmv_product_tag($tag = '')
{
    if (!$tag) {
        shopp_debug(__FUNCTION__ . " failed: Tag name or id required.");
        return false;
    }
    $tag = is_numeric($tag) ? (int) $tag : $tag;
    $Tag = new ProductTag($tag, is_string($tag) ? 'name' : 'id');
    if (empty($Tag->id)) {
        return false;
    }
    $success = shopp_rmv_meta($Tag->id, 'tag');
    return $success && $Tag->delete();
}