WC_Breadcrumb::term_ancestors( int $term_id, string $taxonomy )

Add crumbs for a term.


Description Description


Parameters Parameters

$term_id

(Required) Term ID.

$taxonomy

(Required) Taxonomy.


Top ↑

Source Source

File: includes/class-wc-breadcrumb.php

	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 ) );
			}
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

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