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.
Changelog
Since 3.1.0 | Introduced. |
Code of wp_get_term_taxonomy_parent_id() wp get term taxonomy parent id WP 5.6
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)
- get_term()
- get_term_by()
- get_term_children()
- get_term_field()
- get_term_link()
- get_terms()
- get_the_term_list()
More from category: Any taxonomy
- edit_term_link()
- get_edit_term_link()
- get_taxonomies()
- get_taxonomy()
- is_taxonomy_hierarchical()
- register_taxonomy()