is there a way of getting term children that only shows those from two taxonomies

hi so I am trying to list the terms ( product categories ) but only those that exist in another custom taxonomy, say 'workplaces'.

I have the below code that does this, but without taking into account the custom taxonomy archive object ID. I can't seem to figure it out if anyone has any insight it would be very helpful.

thank you

/**
 * gets term children, but not specific to custom taxonomy
 */

$term_id = 595;
$taxonomy_name = 'product_cat';
$termchildren = get_term_children( $term_id, $taxonomy_name );
 
echo 'ul';
foreach ( $termchildren as $child ) {
    $term = get_term_by( 'id', $child, $taxonomy_name );
    echo 'lia href=' . get_term_link( $child, $taxonomy_name ) . '' . $term-name . '/a/li';
}
echo '/ul';

Topic custom-post-type-archives terms custom-taxonomy Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.