wp_get_term_taxonomy_parent_id()
Returns the term's parent's term_ID.
Uses: get_term()
No Hooks.
Return
Int|false
. Parent term ID on success, false on failure.
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 6.0
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; }