Hi, i think this is some part of the code to use ?
private function maybe_add_taxonomy_crumbs_for_post() {
if ( WPSEO_Options::get( 'post_types-' . $this->post->post_type . '-maintax' ) && (string) WPSEO_Options::get( 'post_types-' . $this->post->post_type . '-maintax' ) !== '0' ) {
$main_tax = WPSEO_Options::get( 'post_types-' . $this->post->post_type . '-maintax' );
if ( isset( $this->post->ID ) ) {
$terms = get_the_terms( $this->post, $main_tax );
if ( is_array( $terms ) && $terms !== array() ) {
$primary_term = new WPSEO_Primary_Term( $main_tax, $this->post->ID );
if ( $primary_term->get_primary_term() ) {
$breadcrumb_term = get_term( $primary_term->get_primary_term(), $main_tax );
}
else {
$breadcrumb_term = $this->find_deepest_term( $terms );
}
if ( is_taxonomy_hierarchical( $main_tax ) && $breadcrumb_term->parent !== 0 ) {
$parent_terms = $this->get_term_parents( $breadcrumb_term );
foreach ( $parent_terms as $parent_term ) {
$this->add_term_crumb( $parent_term );
}
}
$this->add_term_crumb( $breadcrumb_term );
}
}
}
}