WordPress at a glance

wp_get_term_taxonomy_parent_id() WP 1.0

Returns the term's parent's term_ID.

Works based on: get_term()

No Hooks.

Return

Int/false. False on error.

Usage

wp_get_term_taxonomy_parent_id( $term_id, $taxonomy );
$term_id(int) (required)
Term ID.
$taxonomy(string) (required)
Taxonomy name.

Code of wp_get_term_taxonomy_parent_id: wp-includes/taxonomy.php VER 4.9.8

<?php
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;
}

Related Functions

From tag: Term (taxonomies terms)

More from category: Any taxonomy

No comments
    Hello, !     Log In . Register