wp_get_term_taxonomy_parent_id

The timeline below displays how wordpress function wp_get_term_taxonomy_parent_id has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Returns the term's parent's term ID.
 *
 * @since 3.1.0
 *
 * @param int    $term_id  Term ID.
 * @param string $taxonomy Taxonomy name.
 * @return int|false Parent term ID on success, false on failure.
 */
function wp_get_term_taxonomy_parent_id($term_id, $taxonomy)
{
    $term = get_term($term_id, $taxonomy);
    if (!$term || is_wp_error($term)) {
        return false;
    }
    return (int) $term->parent;
}

WordPress Version: 5.7

/**
 * Returns the term's parent's term_ID.
 *
 * @since 3.1.0
 *
 * @param int    $term_id  Term ID.
 * @param string $taxonomy Taxonomy name.
 * @return int|false Parent term ID on success, false on failure.
 */
function wp_get_term_taxonomy_parent_id($term_id, $taxonomy)
{
    $term = get_term($term_id, $taxonomy);
    if (!$term || is_wp_error($term)) {
        return false;
    }
    return (int) $term->parent;
}

WordPress Version: 4.3

/**
 * Returns the term's parent's term_ID.
 *
 * @since 3.1.0
 *
 * @param int    $term_id  Term ID.
 * @param string $taxonomy Taxonomy name.
 * @return int|false False on error.
 */
function wp_get_term_taxonomy_parent_id($term_id, $taxonomy)
{
    $term = get_term($term_id, $taxonomy);
    if (!$term || is_wp_error($term)) {
        return false;
    }
    return (int) $term->parent;
}

WordPress Version: 3.7

/**
 * Returns the term's parent's term_ID
 *
 * @since 3.1.0
 *
 * @param int $term_id
 * @param string $taxonomy
 *
 * @return int|bool false on error
 */
function wp_get_term_taxonomy_parent_id($term_id, $taxonomy)
{
    $term = get_term($term_id, $taxonomy);
    if (!$term || is_wp_error($term)) {
        return false;
    }
    return (int) $term->parent;
}