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.


Int|false. Parent term ID on success, false on failure.


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


Since 3.1.0 Introduced.

Code of wp_get_term_taxonomy_parent_id() WP 5.7.2

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;

From tag: Term (taxonomies terms)

More from category: Any taxonomy

No comments
    Log In