private function addHierarchyOfSingularCrumbs( $post ) {
		$post_type = get_post_type_object( $post->post_type );
		if ( $post_type && $post_type->has_archive ) {
			$this->addCrumb(
				$this->label('post_type', $post_type->label ),
				get_post_type_archive_link( $post_type->name )
			);
		}
		if ( is_post_type_hierarchical( $post_type->name ) ) {
			$ancestors = array_reverse( get_post_ancestors( $post ) );
			if ( $ancestors ) {
				$ancestor_posts = get_posts( [
					'post_type' => $post_type->name,
					'include'   => join(',', $ancestors )
				] );
				foreach ( $ancestors as $ancestor ) {
					foreach ( $ancestor_posts as $ancestor_post ) {
						if ( $ancestor == $ancestor_post->ID ) {
							$this->addCrumb( $ancestor_post->post_title, get_permalink( $ancestor_post ) );
						}
					}
				}
			}
		} else {
			$post_type_taxonomies = get_object_taxonomies( $post_type->name, false );
			if ( is_array( $post_type_taxonomies ) && count( $post_type_taxonomies ) ) {
				foreach ( $post_type_taxonomies as $tax_slug => $taxonomy ) {
					if ( $taxonomy->hierarchical ) {
						$terms = get_the_terms( $post->ID, $tax_slug );
						if ( $terms ) {
							$term = array_shift( $terms );
							if ( $term->parent != 0 ) {
								$ancestors = array_reverse( get_ancestors( $term->term_id, $tax_slug ) );
								foreach ( $ancestors as $ancestor_id ) {
									$ancestor = get_term( $ancestor_id, $tax_slug );
									$this->addCrumb( $ancestor->name, get_term_link( $ancestor, $tax_slug ) );
								}
							}
							$this->addCrumb( $term->name, get_term_link( $term, $tax_slug ) );
							break;
						}
					}
				}
			}
		}
	}
private function addHierarchyOfSingularCrumbs( $post ) {
		$post_type = get_post_type_object( $post->post_type );
		if ( $post_type && $post_type->has_archive ) {
			$this->addCrumb(
				$this->label('post_type', $post_type->label ),
				get_post_type_archive_link( $post_type->name )
			);
		}
		if ( is_post_type_hierarchical( $post_type->name ) ) {
			$ancestors = array_reverse( get_post_ancestors( $post ) );
			if ( $ancestors ) {
				$ancestor_posts = get_posts( [
					'post_type' => $post_type->name,
					'include'   => join(',', $ancestors )
				] );
				foreach ( $ancestors as $ancestor ) {
					foreach ( $ancestor_posts as $ancestor_post ) {
						if ( $ancestor == $ancestor_post->ID ) {
							$this->addCrumb( $ancestor_post->post_title, get_permalink( $ancestor_post ) );
						}
					}
				}
			}
		} else {
			$post_type_taxonomies = get_object_taxonomies( $post_type->name, false );
			if ( is_array( $post_type_taxonomies ) && count( $post_type_taxonomies ) ) {
				foreach ( $post_type_taxonomies as $tax_slug => $taxonomy ) {
					if ( $taxonomy->hierarchical ) {
						$terms = get_the_terms( $post->ID, $tax_slug );
						if ( $terms ) {
							$term = array_shift( $terms );
							if ( $term->parent != 0 ) {
								$ancestors = array_reverse( get_ancestors( $term->term_id, $tax_slug ) );
								foreach ( $ancestors as $ancestor_id ) {
									$ancestor = get_term( $ancestor_id, $tax_slug );
									$this->addCrumb( $ancestor->name, get_term_link( $ancestor, $tax_slug ) );
								}
							}
							$this->addCrumb( $term->name, get_term_link( $term, $tax_slug ) );
							break;
						}
					}
				}
			}
		}
	}
private function addHierarchyOfSingularCrumbs ( $ post ) { $ post_type = get_post_type_object ( $ post -> post_type ) ; if ( $ post_type && $ post_type -> has_archive ) { $ this -> addCrumb ( $ this -> label ( 'post_type' , $ post_type -> label ) , get_post_type_archive_link ( $ post_type -> name ) ) ; } if ( is_post_type_hierarchical ( $ post_type -> name ) ) { $ ancestors = array_reverse ( get_post_ancestors ( $ post ) ) ; if ( $ ancestors ) { $ ancestor_posts = get_posts ( [ 'post_type' => $ post_type -> name , 'include' => join ( ',' , $ ancestors ) ] ) ; foreach ( $ ancestors as $ ancestor ) { foreach ( $ ancestor_posts as $ ancestor_post ) { if ( $ ancestor == $ ancestor_post -> ID ) { $ this -> addCrumb ( $ ancestor_post -> post_title , get_permalink ( $ ancestor_post ) ) ; } } } } } else { $ post_type_taxonomies = get_object_taxonomies ( $ post_type -> name , false ) ; if ( is_array ( $ post_type_taxonomies ) && count ( $ post_type_taxonomies ) ) { foreach ( $ post_type_taxonomies as $ tax_slug => $ taxonomy ) { if ( $ taxonomy -> hierarchical ) { $ terms = get_the_terms ( $ post -> ID , $ tax_slug ) ; if ( $ terms ) { $ term = array_shift ( $ terms ) ; if ( $ term -> parent != 0 ) { $ ancestors = array_reverse ( get_ancestors ( $ term -> term_id , $ tax_slug ) ) ; foreach ( $ ancestors as $ ancestor_id ) { $ ancestor = get_term ( $ ancestor_id , $ tax_slug ) ; $ this -> addCrumb ( $ ancestor -> name , get_term_link ( $ ancestor , $ tax_slug ) ) ; } } $ this -> addCrumb ( $ term -> name , get_term_link ( $ term , $ tax_slug ) ) ; break ; } } } } } }
Add Singular Hierarchy Crumbs

@param $post

@return array
Add Singular Hierarchy Crumbs