wp_get_term_taxonomy_parent_id( int $term_id, string $taxonomy )

Returns the term’s parent’s term_ID.


Description Description


Parameters Parameters

$term_id

(int) (Required) Term ID.

$taxonomy

(string) (Required) Taxonomy name.


Top ↑

Return Return

(int|false) False on error.


Top ↑

Source Source

File: wp-includes/taxonomy.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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.