WordPress at Your Fingertips
function is not described

WC_Breadcrumb::term_ancestors() protected WC 1.0

Add crumbs for a term.

{} It's a method of the class: WC_Breadcrumb{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->term_ancestors( $term_id, $taxonomy );
$term_id(int) (required)
Term ID.
$taxonomy(string) (required)
Taxonomy.

Code of WC_Breadcrumb::term_ancestors() WC 5.8.0

protected function term_ancestors( $term_id, $taxonomy ) {
	$ancestors = get_ancestors( $term_id, $taxonomy );
	$ancestors = array_reverse( $ancestors );

	foreach ( $ancestors as $ancestor ) {
		$ancestor = get_term( $ancestor, $taxonomy );

		if ( ! is_wp_error( $ancestor ) && $ancestor ) {
			$this->add_crumb( $ancestor->name, get_term_link( $ancestor ) );
		}
	}
}